Camshift Algorithm and Grayscaled Images

asked 2015-05-11 02:53:05 -0600

karmaDet gravatar image

I was wondering whether we could use Camshift with non-HSV images, as every solution on internet simply convert the image into HSV space, single out the H channel and then go further. However, I am supposed to work with grayscaled images, therefore I cannot go for HSV space.

Is there a way to use Camshift algorithm in OpenCV, without being bothered by HSV space and all? Or does it algorithm strictly require HSV space convertion? I looked into OpenCV exaple of Camshift, and there also HSV is used.

What do you think?

edit retag flag offensive close merge delete


camshift is trying to track unique values (like e.g. a certain colour). your grayscale images will have a lot of places with near identical intensity, so, unless you have a scene with very high contrast (like a white blob against black background) chances are low, that it'll work.

berak gravatar imageberak ( 2015-05-11 03:23:47 -0600 )edit

I have my object surrounded with a red boundingbox, this red color is quite unique in my images, since all other colors are non-red colors. Given this, do you think camshift will be able to track the boundingbox?

Edit: I want to do more or less the same as this:

What different is, my image is grayscaled. I have my object detection algorithm running already, all I want to do is to track the detected object now.

karmaDet gravatar imagekarmaDet ( 2015-05-11 03:30:48 -0600 )edit

"However, I am supposed to work with grayscaled images" - well, no real difference between red, green, or blue in grayscale.

berak gravatar imageberak ( 2015-05-11 03:33:59 -0600 )edit

Sorry, I guess I phrased myself wrongly. I am conducting my detection algorithm on grayscaled input, since my camera is infrared camera. However when I am done with the detection, i create a red boundingbox around the detected object, and for this i use an rgb image. At the end, you can safely assume that my image has 3 channels. The detected objects are surrounded by colored rectangles, everything else is grayscaled.

karmaDet gravatar imagekarmaDet ( 2015-05-11 03:37:12 -0600 )edit

oh sure, different story then.

i guess, it's about time to just try it out now ?

berak gravatar imageberak ( 2015-05-11 03:44:36 -0600 )edit

there are some problems regarding tracking in my case.

my camera is not static/stable, it changes its location constantly (it's mounted on a moving vehicle), would camshift be roboust to that?

karmaDet gravatar imagekarmaDet ( 2015-05-11 09:37:51 -0600 )edit

it guess, it will still work (not much difference between a moving object and a moving camera).

just start coding ;)

berak gravatar imageberak ( 2015-05-12 01:46:56 -0600 )edit