Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I started working on a autonomous robot project in my spare time. Everything is finished except the image proccessing part. I want my robot to follow an object with particular properties. For the start, I decided to use color as the particular property. For example if object's color is yellow, then I want my robot to chase it. I am using OpenCV and tried some of the sample codes but the problem is that in real world lightning is not uniform and the sample codes which I tried did not do a good job because of the changing threshold.

So what can I do? What do you prefer to me? (Are there any better sample codes, algorithm suggestions etc?) I will appreciate if you explain your suggestions as if you were explaining it to someone with nearly none experience with image processing.



share|improve this question
up vote 2 down vote accepted

As you're probably starting to realise this is a very big field with a number of different methods which you can try.

If you want to try to use colour, you can try transforming from RGB to HSV space, which attempts to decouple the colour from the "lightness", this may improve your lighting inconsistencies.

The next problem is how to track your object. If you know the object's colour distribution (histogram) then you can use backprojection to assign a likelihood to each pixel being that colour, then perhaps you could simply track the centre of mass of the back projection.

Alternatively, you could look into template matching, where a template is scanned across the image and areas which match this template closely are scored more highly than non-matches, giving you likely areas for where the object is.

If you have any more specific information about what you are trying to acomplish, it will be easier to help you: do you have an example input image, with targeted highlighted?

share|improve this answer
Thank you so much for your help. Currently I do not have an example input image. But as a beginning I am planning to use a yellow table tennis ball to test my code. – Amadeus Bachmann Dec 11 '12 at 16:17
Maybe what would help too is applying gamma correction ( before trying to detect the yellow tennis ball – Ojtwist Dec 18 '12 at 8:50

If you want to trace color then as starting you could use color matching using minimun color difference. Morever, i will suggest you to convert your image into LAB color space because it is uniform and will surely give you better results than that using RGB space

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.