Following colored objects with Python
Now we have some basics ready; we can use this to build some more interesting behaviors.
We will create a behavior that will chase, but not get too close to, a colored object. This behavior will make the robot seem very intelligent. We will revisit color models, covered in Chapter 9, Programming RGB Strips in Python. We'll add color masking and filtering and use the OpenCV contours tools to detect the largest blob of color in an image and point the robot at it.
Building the color-chasing behavior requires a few steps. Let's start with a diagram showing an overview of this whole behavior in Figure 13.12:
The flow of data in Figure 13.12 starts from camera images. These go through visual processing to get object info from image. get object info from image outputs the object's size (based on the radius of a circle around it) and the object's...