Hi all,
I am on a new project where i want me raspberry pi to execute the following.
Hardware: Rapsberry pi 4b
2 servo motors sg90
web camera (usb)
PCA9685
Aim: Object detection and tracking
I have succesfully make my camera to detect the position of an object but i cant find out how i can make the camera follow the object in the pan/tilt stage. Can anyone suggest me a working code to do so?
Thanks in advance !!
Re: Web camera position controlled by servos using object tracking
Paul McWhorter has a wonderful series of videos on doing exactly this. He uses OpenCV from Python to do the object detection and ends up driving two servos to pan and tilt a camera for tracking.
https://www.youtube.com/watch?v=5INy0Fv ... RFFPkOuP4_
He does it all on an Nvidea Jetson Nano computer but I'm very sure everything he does there will work on the Pi as well. Albeit a bit slower.
See a significant result here:
https://www.youtube.com/watch?v=CW7NGWE ... _&index=32
It's a long seres but if you are a beginner to all this there is a lot to learn. Perhaps skip parts that are specific to the Jetson Nano.
Edit: Do not be put off by the "AI" in the title of his series. He does not introduce any Artificial Intelligence until after the link I posted above. It's all just normal OpenCV stuff up to that point.
https://www.youtube.com/watch?v=5INy0Fv ... RFFPkOuP4_
He does it all on an Nvidea Jetson Nano computer but I'm very sure everything he does there will work on the Pi as well. Albeit a bit slower.
See a significant result here:
https://www.youtube.com/watch?v=CW7NGWE ... _&index=32
It's a long seres but if you are a beginner to all this there is a lot to learn. Perhaps skip parts that are specific to the Jetson Nano.
Edit: Do not be put off by the "AI" in the title of his series. He does not introduce any Artificial Intelligence until after the link I posted above. It's all just normal OpenCV stuff up to that point.
Memory in C++ is a leaky abstraction .
Re: Web camera position controlled by servos using object tracking
Hi,
For object tracking, I would suggest using an action camera (like a GoPro). RPLidar is also a viable option for tracking objects in real-time.
Hope this helps!
For object tracking, I would suggest using an action camera (like a GoPro). RPLidar is also a viable option for tracking objects in real-time.
Hope this helps!
Re: Web camera position controlled by servos using object tracking
Also worth taking a look at FRC (robotics) as many teams use Pis and OpenCV for vision target tracking, as all recent games have retroreflective vision/goal targets and many teams also use vision as part of game piece acquisition systems. Most teams publish and share their code. Two most common development languages are Python and C.
Common applications include fixed cameras applying steering corrections to the robot, and independant 2 or 3 axis acquisition systems.
Common applications include fixed cameras applying steering corrections to the robot, and independant 2 or 3 axis acquisition systems.
Re: Web camera position controlled by servos using object tracking
If you are interested in a ready-to-use video tracking solution with the Rpi, you can have a look at this:
https://www.linux-projects.org/uv4l/tut ... nsor-flow/
https://www.linux-projects.org/uv4l/tut ... nsor-flow/