:param image:Source images (though you may pass CvMat** as well)
:type image:sequence of :class:`IplImage`
:param back_project:Destination back projection image of the same type as the source images
:type back_project::class:`CvArr`
:param hist:Histogram
:type hist::class:`CvHistogram`
The function calculates the back project of the histogram. For each
tuple of pixels at the same position of all input single-channel images
the function puts the value of the histogram bin, corresponding to the
tuple in the destination image. In terms of statistics, the value of
each output image pixel is the probability of the observed tuple given
the distribution (histogram). For example, to find a red object in the
picture, one may do the following:
#.
Calculate a hue histogram for the red object assuming the image contains only this object. The histogram is likely to have a strong maximum, corresponding to red color.
#.
Calculate back projection of a hue plane of input image where the object is searched, using the histogram. Threshold the image.
#.
Find connected components in the resulting picture and choose the right component using some additional criteria, for example, the largest connected component.
That is the approximate algorithm of Camshift color object tracker, except for the 3rd step, instead of which CAMSHIFT algorithm is used to locate the object on the back projection given the previous object position.
Locates a template within an image by using a histogram comparison.
:param images:Source images (though, you may pass CvMat** as well)
:type images:sequence of :class:`IplImage`
:param dst:Destination image
:type dst::class:`CvArr`
:param patch_size:Size of the patch slid though the source image
:type patch_size::class:`CvSize`
:param hist:Histogram
:type hist::class:`CvHistogram`
:param method:Comparison method, passed to :ref:`CompareHist` (see description of that function)
:type method:int
:param factor:Normalization factor for histograms, will affect the normalization scale of the destination image, pass 1 if unsure
:type factor:float
The function calculates the back projection by comparing histograms of the source image patches with the given histogram. Taking measurement results from some image at each location over ROI creates an array
``image``
. These results might be one or more of hue,
``x``
derivative,
``y``
derivative, Laplacian filter, oriented Gabor filter, etc. Each measurement output is collected into its own separate image. The
``image``
image array is a collection of these measurement images. A multi-dimensional histogram
``hist``
is constructed by sampling from the
``image``
image array. The final histogram is normalized. The
``hist``
histogram has as many dimensions as the number of elements in
``image``
array.
Each new image is measured and then converted into an
``image``
image array over a chosen ROI. Histograms are taken from this
``image``
image in an area covered by a "patch" with an anchor at center as shown in the picture below. The histogram is normalized using the parameter
``norm_factor``
so that it may be compared with
``hist``
. The calculated histogram is compared to the model histogram;
``hist``
uses The function
``cvCompareHist``
with the comparison method=
``method``
). The resulting output is placed at the location corresponding to the patch anchor in the probability image
``dst``
. This process is repeated as the patch is slid over the ROI. Iterative histogram update by subtracting trailing pixels covered by the patch and adding newly covered pixels to the histogram can save a lot of operations, though it is not implemented yet.
:param image:Source images (though you may pass CvMat** as well)
:type image:sequence of :class:`IplImage`
:param hist:Pointer to the histogram
:type hist::class:`CvHistogram`
:param accumulate:Accumulation flag. If it is set, the histogram is not cleared in the beginning. This feature allows user to compute a single histogram from several images, or to update the histogram online
:type accumulate:int
:param mask:The operation mask, determines what pixels of the source images are counted
:type mask::class:`CvArr`
The function calculates the histogram of one or more
single-channel images. The elements of a tuple that is used to increment
a histogram bin are taken at the same location from the corresponding
:param dims:for an N-dimensional histogram, list of length N giving the size of each dimension
:type dims:sequence of int
:param type:Histogram representation format: ``CV_HIST_ARRAY`` means that the histogram data is represented as a multi-dimensional dense array CvMatND; ``CV_HIST_SPARSE`` means that histogram data is represented as a multi-dimensional sparse array CvSparseMat
:type type:int
:param ranges:Array of ranges for the histogram bins. Its meaning depends on the ``uniform`` parameter value. The ranges are used for when the histogram is calculated or backprojected to determine which histogram bin corresponds to which value/tuple of values from the input image(s)
:type ranges:list of tuples of ints
:param uniform:Uniformity flag; if not 0, the histogram has evenly
spaced bins and for every :math:`0<=i<cDims```ranges[i]``
is an array of two numbers: lower and upper boundaries for the i-th
histogram dimension.
The whole range [lower,upper] is then split
into ``dims[i]`` equal parts to determine the ``i-th`` input
tuple value ranges for every histogram bin. And if ``uniform=0`` ,
then ``i-th`` element of ``ranges`` array contains ``dims[i]+1`` elements: :math:`\texttt{lower}_0, \texttt{upper}_0,