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?

Please tell me if you guys need more information.

Help would be greatly appreciated!