After thresholding an image and viewing the video feed from the Pi camera, we will combine both of these programs to create our object-following robot program.
In this section, we will write two programs. In the first program, we place the ball in front of the camera and trace it by creating a dot (using moments) in the center of the ball. Next, we will move the ball up, down, left, and right and note the point values at different positions on the camera.
In the second program, we will use these point values as an input and make the robot follow the ball object.