This is a OpenCV application that applies filters in order to track specific HSV ranges. By default, it tracks a red laser pointer, but it is modular and you can track about whatever you want.
This requires Python2 and the Python wrapper for OpenCV. It was tested on GNU/Linux distributions and Mac OS X.
Run python laser_tracker/laser_tracker.py -h
for help on the available command-line parameters.
- Range for each HSV components:
- hue: [0, 180]
- saturation: [0, 255]
- value: [0, 255]
The code performs the following steps, and displays the results in several windows. The general idea is to:
- Grab the video frame.
- Convert it to HSV
- Split the frame into individual components (separate images for H, S, and V)
- Apply a threshold to each compenent (hopefully keeping just the dot from the laser)
- Perform an AND operation on the 3 images (which "should" cut down on false positives)
- Display the result.
The filtering part is done using successive thresholding
This code is MIT-licensed. You can basically do whatever you want with it.
Any suggestions, bug reports, or pull requests are welcome! If there's something I should be doing differently, here, feel free to open an Issue and let me know.