Using a Pan/Tilt Camera Servo to Track an Object of Interest in OpenCV

In this Video Lesson we show an initial control system that allows us to position a camera on a pan/tilt servo system to keep an object of interest in the center of the frame. The pan/tilt servo hat will continuously adjust so that the object we are tracking remains in the center of the frame. In this example we are only tracking in the ‘pan’ direction. It is left as a homework assignment for the student to extend the software to also track in the tilt direction. This should be a straightforward extension to our pan example.

 

Tracking an Object of Interest in OpenCV using Contours on the Raspberry Pi

In this video lesson we show how to track an object of interest based on color in OpenCV. We show how to create masks, contours, and then how to box the contour of the object of interest. We also show a convenient way to train the system for finding the Object of Interest. For your convenience, the code is included below.

 

Tracking an Object of Interest Based on Color in OpenCV on Raspberry Pi


 

In this video lesson we show how you can track an object of interest in OpenCV on the Raspberry Pi. We do this by tracking color in the HSV color space. We dial in our object of interest using trackbars. For your convenience, the code below is what we developed in our video.

 

Calculating Frames Per Second (FPS) In OpenCV and Overlay on Frame

In this lesson we show how to instrument our code to calculate the Frames Per Second (FPS) we are achieving with our camera and OpenCV. We show how to display the FPS as an overlay on our video frame.

 

Using the Raspberry Pi Camera on Bullseye OS and OpenCV

Then the following code will allow you to grab a frame and show a frame in a window. Looking this sequence creates a live video preview on your Raspberry Pi Screen.

 

Making The World a Better Place One High Tech Project at a Time. Enjoy!

Exit mobile version