Reputation: 1939
Is there any open source or demo code available in C/C++ for OpenCV that does simple ball tracking?
Basically I want to hold a red-colored ball in front of my web camera and I want OpenCV to detect its location. If I move the ball towards the right or left of the screen the program will detect the location of the ball has changed and output its new location.
I have successfully installed Open CV 2.3.1 on the raspberry pi with a web camera, eventually I want to execute the code on the pi.
Upvotes: 3
Views: 4438
Reputation: 691
If you want to detect simple object such as red colored ball, you may consider using pixy camera.
Upvotes: 0
Reputation: 465
The example that you found - Tommed - uses the RGB to track colours.
You would do a lot better looking at the HSV plane. There is an example in the cvBlob library
However people have varying degrees of success with cvBlob on the Pi. Still the principle of HSV remains the way to go.
Upvotes: 0
Reputation: 3334
I just stumbled upon this. It is a cvBlob example and very similar to what you want to do. Source code is here
here.
Upvotes: 3
Reputation: 1939
This seems to be what I'm looking for:
https://github.com/tommed/tommed-opencv-examples/
Upvotes: 2