# Opencv calcHist and calcBackProject in plain english

i've started experimenting with c++ and opencv because of i want to learn image processing.

Now, my first exercise is to create a skin detector with calcHist and calcBackProject.

But i don't understand few things:

• the statistic interpretation of back project, and why it is named "back project"
• i have quite good comprehension of what ranges parameter is in calcBackProject. But i'm really stucked with ranges parameter in calcHist function.
• For more detection precision i think could be a good thing use backgrojection in more levels: in each channel of r-g-b ans in each channel of h-s-v. But i don't know how i can combine the different results of calcBackProject of separate channels of rgb and hsv.

And i think that my not-well comprehension is caused by lack in theory of what i'm doing with those 2 methods (see the first point). So please explain me in plain english.

• I am also very interested in this. Shoot me an email and we can talk about it some more. Mar 11 '12 at 19:28

See What is Back Projection in the openCV tutorials

An image histogram measures the distribution of colour (and brightness) of the pixels in an image.

If you take an image and identify a region of interest eg. a hand, and calculate the histogram of the pixels in that object.

Then take that histogram and a second image and essentially reverse the process - you pick the pixels in the second image that match the histogram from the first. It's this reverse process that gives it the name back-projection.

You then make the assumption that areas of the image in the second image that have the same colour distribution as an object in the first image are an image of the same (or similar) object.