Color Tracking using OpenCV and InRange Filter

Here is me with a tennis ball.. No filter is applied except Pyramid down to resize the video from the cam:

Here is as the ball appears after an InRange filter is applied... I had to tune HSV values in order to isolate the green of the ball...

Next is to find the center of the object and track it...

How can i do it?

Saymon's goal is to build a robot able to track a ball...

The "easiest" way ( except for light influence) is to isolate the object using a color filter...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
borsaci06's picture

Easiest way to make a ball tracking robot...

The easiest way to make a ball tracking robot is to order a Pixy (CMUcam5)... Kickstarter campaign can be found here:

It is a fast tracking module using OpenCV with dedicated microcontroller... really impressive and cheap... But this is not a DIYer approach... We can struggle with hardware at hand and software... :)


Alessandruino's picture

Wow,,,it could be very

Wow,,,it could be very usefull...thanks for the link... maybe i'll buy one :)

borsaci06's picture

bad news...

Bad news... you have to wait until March... I am also following Pixy to buy one.. but it was due to disposal on jan, later feb and now March 2014... they finished up a successful Kickstarter last year but unable to start sending orders... :(

GroG's picture

Check out my super camera I

Check out my super camera I made to test stuff....

usb is too slow !!!  Virtual data rocks ! :D

Here's isolation - wow . virtual data is always PERFECT !

I found all the green things !

BoooYa !  ... got 3 objects - bounding boxes drawn..

Ok.. so I was thinking .... everyone has done color tracking.. 
color tracking is neat, color tracking is fun... but finding the HSV values is a pain..

What we want is something to do this FOR US !   I want an algorithm which searches through all the filter ranges finding the biggest blobs and saves those values ... Ya ?!?!