# Revision history [back]

### Finding corner points for perspective transform without clear landmarks.

Hi, I posted this question two days ago, which leaded me to a new problem to solve.

I need to define 4 trapezoid corner points on an image (golf lawn) without any distinct landmarks on it. Except the balls and the flag. All visible balls and the flag must be in the trapezoid.

@kbarni pointed me to some possible solutions but I'm not sure what to do now.

Also I'm pretty bad at math and I have a hard time understanding the formulas explaining computer vision concepts.

Here are my thoughts about how I could eventually get to the corner points but I have no idea how to do it or if it's even possible.

# Input

This is the image of interest:

# Goal

And those are approximately the corners I'm looking for, here I've set the corners by hand which of course isn't 100% correct.

I don't necessarily need the extra padding between the outer most balls and the lines.

# Solution?

I do know some variables from the image. I do some balls detection using a YOLO model and mark them. The model does a decent job at the moment and will get better so that the balls will be market pretty accurately (I hope).

With the detection I can get/know:

• The balls width/height in pixels/mm
• The balls centroids

At the moment I don't detect the flag but I will soon.

In real life a golf ball has a diameter of 42.67mm and the hole 107.95mm

What I was thinking of is that I could get a trapezoid from the nearest (biggest) ball bottom corners to the furthest (smallest) ball bottom corners and somehow transform and apply it to the group and align it correctly to get my goal corner points?

Is this in any way possible with the given variables and what do you think about this idea?

Help would be greatly appreciated!

### Finding corner points for perspective transform without clear landmarks.

Hi, I posted this question two days ago, which leaded me to a new problem to solve.

I need to define 4 trapezoid corner points on an image (golf lawn) without any distinct landmarks on it. Except the balls and the flag. All visible balls and the flag must be in the trapezoid.

@kbarni pointed me to some possible solutions but I'm not sure what to do now.

Also I'm pretty bad at math and I have a hard time understanding the formulas explaining computer vision concepts.

Here are my thoughts about how I could eventually get to the corner points but I have no idea how to do it or if it's even possible.

# Input

This is the image of interest:

# Goal

And those The goal is to find the corners with the image as is (no extra landmarks placed in real life).

These are approximately the corners I'm looking for, here I've set the corners by hand which of course isn't 100% correct.

I don't necessarily need the extra padding between the outer most balls and the lines.

# Solution?

I do know some variables from the image. I do some balls detection using a YOLO model and mark them. The model does a decent job at the moment and will get better so that the balls will be market pretty accurately (I hope).

With the detection I can get/know:

• The balls width/height in pixels/mm
• The balls centroids

At the moment I don't detect the flag but I will soon.

In real life a golf ball has a diameter of 42.67mm and the hole 107.95mm

What I was thinking of is that I could get a trapezoid from the nearest (biggest) ball bottom corners to the furthest (smallest) ball bottom corners and somehow transform and apply it to the group and align it correctly to get my goal corner points?

Is this in any way possible with the given variables and what do you think about this idea?

Help would be greatly appreciated!

### Finding corner points for perspective transform without clear landmarks.

Hi, I posted this question two days ago, which leaded me to a new problem to solve.

I need to define 4 trapezoid corner points on an image (golf lawn) without any distinct landmarks on it. Except the balls and the flag. All visible balls and the flag must be in the trapezoid.

@kbarni pointed me to some possible solutions but I'm not sure what to do now.

Also I'm pretty bad at math and I have a hard time understanding the formulas explaining computer vision concepts.

Here are my thoughts about how I could eventually get to the corner points but I have no idea how to do it or if it's even possible.

# Input

This is the image of interest:

# Goal

The goal is to find the corners with the image as is (no extra landmarks placed in real life).

These are approximately the corners I'm looking for, here I've set the corners by hand which of course isn't 100% correct.

I don't necessarily need the extra padding between the outer most balls and the lines.

# Solution?

I do know some variables from the image. I do some balls detection using a YOLO model and mark them. The model does a decent job at the moment and will get better so that the balls will be market pretty accurately (I hope).

With the detection I can get/know:

• The balls width/height in pixels/mm
• The balls centroids

At the moment I don't detect the flag but I will soon.

In real life a golf ball has a diameter of 42.67mm and the hole 107.95mm

What I was thinking of is that I could get a trapezoid from the nearest (biggest) ball bottom corners to the furthest (smallest) ball bottom corners and somehow transform and apply it to the group and align it correctly to get my goal corner points?

Is this in any way possible with the given variables and what do you think about this idea?

Help would be greatly appreciated!

### Finding corner points for perspective transform without clear landmarks.

Hi, I posted this question two days ago, which leaded me to a new problem to solve.

I need to define 4 trapezoid corner points on an image (golf lawn) without any distinct landmarks on it. Except the balls and the flag. All visible balls and the flag must be in the trapezoid.

@kbarni pointed me to some possible solutions but I'm not sure what to do now.

Also I'm pretty bad at math and I have a hard time understanding the formulas explaining computer vision concepts.

Here are my thoughts about how I could eventually get to the corner points but I have no idea how to do it or if it's even possible.

# Input

This is the image of interest:

# Goal

The goal is to find the corners with the image as is (no extra landmarks placed in real life).

These are approximately the corners I'm looking for, here I've set the corners by hand which of course isn't 100% correct.

I don't necessarily need the extra padding between the outer most balls and the lines.

# Solution?

I do know some variables from the image. I do some balls detection using a YOLO and mark them. The model does a decent job at the moment and will get better so that the balls will be market pretty accurately (I hope).

With the detection I can get/know:

• The balls width/height in pixels/mm
• The balls centroids

At the moment I don't detect the flag but I will soon.

In real life a golf ball has a diameter of 42.67mm and the hole 107.95mm

What I was thinking of is that I could get a trapezoid from the nearest (biggest) ball bottom corners to the furthest (smallest) ball bottom corners and somehow transform and apply it to the group and align it correctly to get my goal corner points?

Is this in any way possible with the given variables and what do you think about this idea?

Help would be greatly appreciated!

### Finding corner points for perspective transform without clear landmarks.

Hi, I posted this question two days ago, which leaded me to a new problem to solve.

I need to define 4 trapezoid corner points on an image (golf lawn) without any distinct landmarks on it. Except the balls and the flag. All visible balls and the flag must be in the trapezoid.

@kbarni pointed me to some possible solutions but I'm not sure what to do now.

Also I'm pretty bad at math and I have a hard time understanding the formulas explaining computer vision concepts.

Here are my thoughts about how I could eventually get to the corner points but I have no idea how to do it or if it's even possible.

# Input

This is the image of interest:

# Goal

The goal is to find the corners with the image as is (no extra landmarks placed in real life).

These are approximately the corners I'm looking for, here I've set the corners by hand which of course isn't 100% correct.

I don't necessarily need the extra padding between the outer most balls and the lines.

# Solution?

I do know some variables from the image. I do some balls detection using YOLO and mark them. The model does a decent job at the moment and will get better so that the balls will be market pretty accurately (I hope).

With the detection I can get/know:

• The balls width/height in pixels/mm
• The balls centroids

At the moment I don't detect the flag but I will soon.

In real life a golf ball has a diameter of 42.67mm and the hole 107.95mm

What I was thinking of is that I could get a trapezoid from the nearest (biggest) ball bottom corners to the furthest (smallest) ball bottom corners (or something similar) and somehow transform and apply it to the group and align it correctly to get my goal corner points?

Is this in any way possible with the given variables and what do you think about this idea?

Help would be greatly appreciated!

### Finding corner points for perspective transform without clear landmarks.

Hi, I posted this question two days ago, which leaded me to a new problem to solve.

I need to define 4 trapezoid corner points on an image (golf lawn) without any distinct landmarks on it. Except the balls and the flag. All visible balls and the flag must be in the trapezoid.

@kbarni pointed me to some possible solutions but I'm not sure what to do now.

Also I'm pretty bad at math and I have a hard time understanding the formulas explaining computer vision concepts.

Here are my thoughts about how I could eventually get to the corner points but I have no idea how to do it or if it's even possible.

# Input

This is the image of interest:

# Goal

The goal is to find the corners with the image as is (no extra landmarks placed in real life).

These are approximately the corners I'm looking for, here I've set the corners by hand which of course isn't 100% correct.accurate.

I don't necessarily need the extra padding between the outer most balls and the lines.

# Solution?

I do know some variables from the image. I do some balls detection using YOLO and mark them. The model does a decent job at the moment and will get better so that the balls will be market pretty accurately (I hope).

With the detection I can get/know:

• The balls width/height in pixels/mm
• The balls centroids

At the moment I don't detect the flag but I will soon.

In real life a golf ball has a diameter of 42.67mm and the hole 107.95mm

What I was thinking of is that I could get a trapezoid from the nearest (biggest) ball bottom corners to the furthest (smallest) ball bottom corners (or something similar) and somehow transform and apply it to the group and align it correctly to get my goal corner points?

Is this in any way possible with the given variables and what do you think about this idea?

Help would be greatly appreciated!

### Finding corner points for perspective transform without clear landmarks.

Hi, I posted this question two days ago, which leaded me to a new problem to solve.

I need to define 4 trapezoid corner points on an image (golf lawn) without any distinct landmarks on it. Except the balls and the flag. All visible balls and the flag must be in the trapezoid.

@kbarni pointed me to some possible solutions but I'm not sure what to do now.

Also I'm pretty bad at math and I have a hard time understanding the formulas explaining computer vision concepts.

Here are my thoughts about how I could eventually get to the corner points but I have no idea how to do it or if it's even possible.

# Input

This is the image of interest:

# Goal

The goal is to find the corners with the image as is (no extra landmarks placed in real life).

These are approximately the corners I'm looking for, here I've set the corners by hand which of course isn't 100% accurate.

The corners will be used with getPerspectiveTransform and warpPerspective to get a top down view.

I don't necessarily need the extra padding between the outer most balls and the lines.

# Solution?

I do know some variables from the image. I do some balls detection using YOLO and mark them. The model does a decent job at the moment and will get better so that the balls will be market pretty accurately (I hope).

With the detection I can get/know:

• The balls width/height in pixels/mm
• The balls centroids

At the moment I don't detect the flag but I will soon.

In real life a golf ball has a diameter of 42.67mm and the hole 107.95mm

What I was thinking of is that I could get a trapezoid from the nearest (biggest) ball bottom corners to the furthest (smallest) ball bottom corners (or something similar) and somehow transform and apply it to the group and align it correctly to get my goal corner points?

Is this in any way possible with the given variables and what do you think about this idea?

Help would be greatly appreciated!

### Finding corner points for perspective transform without clear landmarks.

Hi, I posted this question two days ago, which leaded me to a new problem to solve.

I need to define 4 trapezoid corner points on an image (golf lawn) without any distinct landmarks on it. Except the balls and the flag. All visible balls and the flag must be in the trapezoid.

@kbarni pointed me to some possible solutions but I'm not sure what to do now.

Also I'm pretty bad at math and I have a hard time understanding the formulas explaining computer vision concepts.

Here are my thoughts about how I could eventually get to the corner points but I have no idea how to do it or if it's even possible.

# Input

This is the image of interest:

# Goal

The goal is to find the corners with the image as is (no extra landmarks markers placed in real life).

These are approximately the corners I'm looking for, here I've set the corners by hand which of course isn't 100% accurate.

The corners will be used with getPerspectiveTransform and warpPerspective to get a top down view.

I don't necessarily need the extra padding between the outer most balls and the lines.

# Solution?

I do know some variables from the image. I do some balls detection using YOLO and mark them. The model does a decent job at the moment and will get better so that the balls will be market pretty accurately (I hope).

With the detection I can get/know:

• The balls width/height in pixels/mm
• The balls centroids

At the moment I don't detect the flag but I will soon.

In real life a golf ball has a diameter of 42.67mm and the hole 107.95mm

What I was thinking of is that I could get a trapezoid from the nearest (biggest) ball bottom corners to the furthest (smallest) ball bottom corners (or something similar) and somehow transform and apply it to the group and align it correctly to get my goal corner points?

Is this in any way possible with the given variables and what do you think about this idea?

Help would be greatly appreciated!

### Finding corner points for perspective transform without clear landmarks.

Hi, I posted this question two days ago, which leaded me to a new problem to solve.

I need to define 4 trapezoid corner points on an image (golf lawn) without any distinct landmarks on it. Except the balls and the flag. All visible balls and the flag must be in the trapezoid.

@kbarni pointed me to some possible solutions but I'm not sure what to do now.

Also I'm pretty bad at math and I have a hard time understanding the formulas explaining computer vision concepts.

Here are my thoughts about how I could eventually get to the corner points but I have no idea how to do it or if it's even possible.

# Input

This is the image of interest:

# Goal

The goal is to find the corners with the image as is (no extra markers placed in real life).

These are approximately the corners I'm looking for, here I've set the corners by hand which of course isn't 100% accurate.

The corners will be used with getPerspectiveTransform and warpPerspective to get a top down view.

I don't necessarily need the extra padding between the outer most balls and the lines.

# Solution?

I do know some variables from the image. I do some balls detection using YOLO and mark them. The model does a decent job at the moment and will get better so that the balls will be market pretty accurately (I hope).

With the detection I can get/know:

• The balls width/height in pixels/mm
• The balls centroids

At the moment I don't detect the flag but I will soon.

In real life a golf ball has a diameter of 42.67mm and the hole 107.95mm

What I was thinking of is that I could get a trapezoid from the nearest (biggest) ball bottom corners to the furthest (smallest) ball bottom corners (or something similar) and somehow transform and apply it to the group and align it correctly to get my goal corner points?

Is this in any way possible with the given variables and what do you think about this idea?

Help would be greatly appreciated!

# Edit/Results

Here are my results after applying @kbarni s answer below and they are pretty awsome imo, even if there is still some work pending to get this done perfectly.

I changed the provided formula a little bit:

(0, C.y),(W,C.y),(W/2+R*W,F.y),(W/2-R*W,F.y)

Where C.y is taken from a bottom corner and F.y from a top corner to have all balls inside the trapezoid.

And here is the top down view result at the moment.

### Finding corner points for perspective transform without clear landmarks.

Hi, I posted this question two days ago, which leaded me to a new problem to solve.

I need to define 4 trapezoid corner points on an image (golf lawn) without any distinct landmarks on it. Except the balls and the flag. All visible balls and the flag must be in the trapezoid.

@kbarni pointed me to some possible solutions but I'm not sure what to do now.

Also I'm pretty bad at math and I have a hard time understanding the formulas explaining computer vision concepts.

Here are my thoughts about how I could eventually get to the corner points but I have no idea how to do it or if it's even possible.

# Input

This is the image of interest:

# Goal

The goal is to find the corners with the image as is (no extra markers placed in real life).

These are approximately the corners I'm looking for, here I've set the corners by hand which of course isn't 100% accurate.

The corners will be used with getPerspectiveTransform and warpPerspective to get a top down view.

I don't necessarily need the extra padding between the outer most balls and the lines.

# Solution?

I do know some variables from the image. I do some balls detection using YOLO and mark them. The model does a decent job at the moment and will get better so that the balls will be market pretty accurately (I hope).

With the detection I can get/know:

• The balls width/height in pixels/mm
• The balls centroids

At the moment I don't detect the flag but I will soon.

In real life a golf ball has a diameter of 42.67mm and the hole 107.95mm

What I was thinking of is that I could get a trapezoid from the nearest (biggest) ball bottom corners to the furthest (smallest) ball bottom corners (or something similar) and somehow transform and apply it to the group and align it correctly to get my goal corner points?

Is this in any way possible with the given variables and what do you think about this idea?

Help would be greatly appreciated!

# Edit/Results

Here are my results after applying @kbarni s answer below and they are pretty awsome awesome imo, even if there is still some work pending to get this done perfectly.

I changed the provided formula a little bit:

(0, C.y),(W,C.y),(W/2+R*W,F.y),(W/2-R*W,F.y)

Where C.y is taken from a bottom corner and F.y from a top corner to have all balls inside the trapezoid.

And here is the top down view result at the moment.