Color detection with OpenCV
We shall begin experimenting with OpenCV by performing some basic operations on live image data. In this recipe, we shall perform some basic image processing to allow detection of different colored objects and track their location on screen.
Getting ready
In addition to the setup from the previous recipe, you will need a suitable colored object to track. For example, a small colored ball, a suitable colored mug, or a pencil with a square of colored paper taped to it is ideal. The example should allow you to detect the location (indicated by a color spot) of blue, green, red, magenta (pink) or yellow objects.
Get Raspberry Pi for Python Programmers Cookbook - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.