MATLAB File Help: cv.calcBackProject Index
cv.calcBackProject

Calculates the back projection of a histogram

backProject = cv.calcBackProject(images, H, ranges)
backProject = cv.calcBackProject(..., 'OptionName',optionValue, ...)

Input

Output

Options

The function cv.calcBackProject calculates the back project of the histogram. That is, similarly to cv.calcHist, at each location (x, y) the function collects the values from the selected channels in the input images and finds the corresponding histogram bin. But instead of incrementing it, the function reads the bin value, scales it by scale, and stores in backProject(x,y). In terms of statistics, the function computes probability of each element value in respect with the empirical probability distribution represented by the histogram. See how, for example, you can find and track a bright-colored object in a scene:

  1. Before tracking, show the object to the camera so that it covers almost the whole frame. Calculate a hue histogram. The histogram may have strong maximums, corresponding to the dominant colors in the object.
  2. When tracking, calculate a back projection of a hue plane of each input video frame using that pre-computed histogram. Threshold the back projection to suppress weak colors. It may also make sense to suppress pixels with non-sufficient color saturation and too dark or too bright pixels.
  3. Find connected components in the resulting picture and choose, for example, the largest component.

This is an approximate algorithm of the cv.CamShift color object tracker.

See also