cv.calcBackProject - MATLAB File Help |
Calculates the back projection of a histogram
backProject = cv.calcBackProject(images, H, ranges)
backProject = cv.calcBackProject(..., 'OptionName',optionValue, ...)
uint8
, uint16
, or
single
) and the same row/column size. Each of them can have an arbitrary
number of channels.images
(if numeric) or
images{1}
(if images
is a cell array). Out of uint8
, uint16
, or
single
classes. Pay attention to the data type of the back projection
array, where integer types are clamped to the maximum intmax
if a value
exceeds the largest possible integer of the type.0
to
size(images{1},3)-1
, the second array channels are counted from
size(images{1},3)
to size(images{1},3) + size(images{2},3)-1
, and so
on. By default, all channels from all images are used, i.e default is
0:sum(cellfun(@(im)size(im,3), images))-1
when input images
is a cell
array, and 0:(size(images,3)-1)
when input images
is a numeric array.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:
This is an approximate algorithm of the cv.CamShift color object tracker.