Ask Your Question

Right method for color object tracking

asked 2015-09-16 11:13:56 -0500

Eisen gravatar image

updated 2015-09-16 11:15:17 -0500

Hi, I am trying to detect colored balls like ps3 move controller balls from 2 mt distance.I have 10 camera in same room hanging from the ceiling.Room is dark and balls have led inside.I have 4-5 balls.(red,blue,green,yellow,pink). I want track their position with opencv.Whats the right mehtod for doing this in opencv ? Can u give link , example for this ?

Why am i doing this ? I attach this balls to humans head and track their position.After that transfer their position to my program.For example i will see red person in x:39 y:69 blue person x:49 y:59 ....

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted

answered 2015-09-16 11:30:21 -0500

updated 2015-09-17 07:01:55 -0500

edit flag offensive delete link more


Meanshift / Camshift algorithms could also be a part of the solution in my opinion.

Eduardo gravatar imageEduardo ( 2015-09-18 03:59:04 -0500 )edit

answered 2015-09-18 15:16:45 -0500

you can use color detection + Kalman filter

  • transform the video frames into HSV color space using cvtColor
  • find a lower and upper bound of HSV values of the color of your balls
  • use inRange to detect the ball, this gives you a binary image where the ones are the pixels of the ball
  • then you may calculate the average of positions of ball pixels to find the center position of ball

you can then feed the position of ball into Kalman filter tracker.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-09-16 11:13:56 -0500

Seen: 252 times

Last updated: Sep 17 '15