This is the code for the "How to do Object Detection with OpenCV" live session by Siraj Raval on Youtube
This is the code for this video on Youtube by Siraj Raval. We'll use OpenCV to detect a strawberry in an image. We'll perform a series of operations which i've documented in the code to eventually highlight the biggest strawberry in an image and then draw a green circle around it.
You can use pip to install any missing dependencies. And you can install OpenCV using this guide.
Run
python demo.py
to create a new image with the detected strawberry. The last 3 lines at the bottom of demo.py let you
define the input image name and the output image name. This detection takes a split second. Deep learning would be more
accurate but requires more computation currently. Sometimes you just need to quickly detect an image and don't
mind handcrafted which features to look for.
Credits for this code go to alexlouden i've merely created a wrapper to get people started.