ArtLabss / tennis-tracking

Open-source Monocular Python HawkEye for Tennis
https://www.artlabs.tech
The Unlicense
419 stars 100 forks source link

How did you decide on filtering horizontal lines by using vertical lines lowest and highest point #27

Closed zdhgreat closed 1 year ago

zdhgreat commented 1 year ago

clean_horizontal = [] h = lowest_vertical_y - highest_vertical_y lowest_vertical_y += h / 15 highest_vertical_y -= h * 2 / 15 I can't understand why you can filer line by only variable division .But this way is really useful .Could you tell the reason

shukkkur commented 1 year ago

@zdhgreat Hi!

The division in the code is used to adjust the range of the horizontal lines that are considered relevant for the document. Specifically, it uses the highest and lowest y-coordinates of the vertical lines detected to determine the range of y-coordinates where the horizontal lines should be located.

The range is adjusted by increasing the lowest_vertical_y value by h / 15 and decreasing the highest_vertical_y value by h * 2 / 15. The h variable is the height of the bounding box containing all the vertical lines detected in the document.

By adjusting the range in this way, the code tries to remove any horizontal lines that are not relevant to the structure of the document. This can be useful in cases where there are many small or irrelevant horizontal lines that may confuse downstream processing of the document.

So, the reason why it filters the lines using only division is that it tries to remove irrelevant horizontal lines by adjusting the range of y-coordinates where the relevant horizontal lines should be located. The division is just a simple mathematical operation that is used to adjust the range based on the height of the bounding box containing the vertical lines.


Update, due to inactivity I am closing this issue. Feel free to re-open or ask additional questions.

zdhgreat commented 1 year ago

Thanks, and now I may have a new question. You know , we can get a top view of court by using a matrix through cv2.findHomography . But when I try to get the speed of tennis ball , it's hard to separate the true position from the mapping coordinates because the height of the tennis ball is also integrated into the coordinates . Do you have any methods to solve this problem.