Computer Vision Golf Range Finder
Computer Vision, OpenCV, Python
Overview
The purpose of this project is to imitate a golf range finder using a normal, non-depth, camera. The program was written using Python and OpenCV and the algorithm pipeline is shown below.
System Pipeline
First, the user takes an image of the flag and draws a rectangle around the flag. This region is cropped out and the color of the flag is then detected. After the color of the flag is found, the flag is cropped out using contour detection and the pixel length of the side of the flag is measured. Using this pixel length, the distance to the flag could be calculated using triangle similarity and displayed on the user’s screen.
Results
Overall, the range finder worked well. It was very precise and accurate for smaller distances. However, as the distances began to increase, the program was less successful. Test results can be seen below. One reason this could be happening is that the farther away the flag is, the smaller it is on the picture. This makes it much more difficult get an accurate pixel count to calculate the distance to the flag. Using a higher resolution image could help mitigate this problem.
Test Results for 5-35 yards
Test Results for 44-132 yards