O'Reilly logo

OpenCV 2 Computer Vision Application Programming Cookbook by Robert Laganière

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the mean shift algorithm to find an object

The result of a histogram backprojection is a probability map that expresses the probability that a given image content is found at a specific image location. Suppose we now know the approximate location of an object in an image, the probability map can be used to find the exact location of the object. The most probable will be the one that maximizes this probability inside a given window. Therefore, if we start from an initial, location and iteratively move around, it should be possible to find the exact object location. This is what is accomplished by the mean shift algorithm.

How to do it...

Suppose we have identified an object of interest, here, a baboon's face, as shown in the following color ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required