This is a simple distance measurement project using a ESPCAM and Arduino IDE.
This project uses OpenCV to track ball movement and measure the distance. The process for tracking is as follows:
- Convert color to HSV
- Create a pixel mask to identify the ball using upper and lower color bounds
- Erode and dilate the mask to reduce noise
- Indentify contours and draw a circle around the ball
To install the python libraries run this command:
python3 -m pip install -r requirements.txt
or
pip3 install -r requirements.txt
In order to install the ESPCAM library, you need to add the following URL to the Arduino IDE: http://arduino.esp8266.com/stable/package_esp8266com_index.json
Run the ball tracking script:
python3 main.py --video name_of_the_video.mp4