12 Try tracking the target

Hold the target up in front of the webcam so that it fills the entire view of the webcam. Make sure that the black stripe crosses the horizontal midline of the camera image (the tracking is based on the horizontal midline of the image).

Run the script track and slowly move the target left and right. The script averages the detected locations of the left and right edges of the stripe and adjusts the panning angle of the camera to keep the center of the stripe in the center of the image. If you keep the paper target in front of the camera without allowing anything in the background from appearing in the image then the camera should follow the target as you move it.

To stop tracking hold the Ctrl key and press the C key in the Command Window.

Type

stopServos

in the Command Window to unpower the servo motors.