# Measure shot distance for basketball and golf?

Let's say you're using OpenCV to do shot tracking for basketball and golf. For basketball, could you use OpenCV to estimate where on the court a shot was taken and the distance of the shot? For golf, could you measure the distance of a shot?

For the basketball scenario, assume the height of the rim is 10 feet.

edit retag close merge delete

2

With a single camera and without any known reference objects at fixed distances from the camera you can't retrieve depth information of the scene because it's being lost when the image is taken.

What do you mean by "shot tracking"? Video analysis or working with a single picture?

( 2016-08-01 06:16:58 -0500 )edit

@David_86 thanks for the comment! So two cameras (similar to human eyes) would let you gauge distance accurately? How do iPhone apps like https://itunes.apple.com/us/app/easym... measure distance? And by shot tracking, assume it's video analysis -- and ideally real-time, but asynchronous is fine as a last resort.

( 2016-08-01 16:30:21 -0500 )edit

@Crashalot yes, simulation of human eyes is what you need to retrieve metric information from the scene. I don't know how that app is working, maybe using multiple frames. No matter what kind of strategy you're using, from a single picture information about dimension/depth of objects is lost: think about a coin just in front of the camera and an elephant 50 m away, they'll look almost the same size. With a couple of cameras, knowing the distance between each other, you can triangulate every common point in the images and calculate its depth through the disparity. The accuracy of the measure depends on this: the far you go from the camera, the little will be the disparity leading to a less accurate triangulation (this is extremely simplified, just to get the idea behind).

( 2016-08-02 06:16:28 -0500 )edit