How Reverse projection Works

Source: Internet
Author: User
Tags ranges

1. What is the role of reverse projection?
Reverse projection is used to find the most matched point or area of a particular image (usually smaller or only 1 pixels, hereinafter referred to as a template image) in the input image (usually larger), that is, where the positioning template image appears in the input image.
2. How Reverse projection Works
The way to find is to continuously cut the image block in the input image with the same size as the template image, and compare it with the template image in the way of the histogram comparison.

For example, we have a 100x100 input image, there is a 10x10 template image, the process of finding is this:
(1) from the upper left corner of the input image (0,0), cut a piece (0,0) to (10,10) temporary image;
(2) generate a histogram of temporary images;
(3) comparing the histogram of temporary image with the histogram of template image, the comparison result is recorded as C;
(4) the histogram comparison result C, is the result image (0,0) at the pixel value;
(5) cut the input image from (0,1) to (10,11) temporary image, contrast the histogram, and record the result image;
(6) repeat (1) ~ (5) Steps until you enter the lower-right corner of the image.

Calcbackproject

Calculates the back projection of a histogram.
C + +: void calcbackproject (const mat* arrays, int narrays, const int* channels, Inputarray hist, Outputarray
Backproject, const float** ranges, double scale=1, BOOL uniform=
True)
C + +: void Calcbackproject (const mat* arrays, int narrays, const int* channels, const sparsemat& hist,
Outputarray backproject, const float** ranges, double scale=1, BOOL uniform=
True)
Python:cv2.calcBackProject (images, channels, hist, ranges[, dst[, scale])!DST
C:void Cvcalcbackproject (iplimage** image, cvarr* backproject, const cvhistogram* hist)
PYTHON:CV. Calcbackproject (Image, Backproject, hist)! None
Parameters

Mat type
Arrays –source arrays. They all should has the same depth, cv_8u or cv_32f, and the
Same size. Each of them can has an arbitrary number of channels.


narrays –number of source arrays.


channels , haven list of channels used to compute the back projection. The number of
Channels must match the histogram dimensionality. The first array channels is numerated
from 0 to Arrays[0].channels ()-1, the second array channels is counted from
Arrays[0].channels () to Arrays[0].channels () + arrays[1].channels ()-1, and
So on.


hist –input histogram that can be dense or sparse.


backproject –destination back projection aray so is a single-channel array of the same
Size and depth as arrays[0].

Ranges –array of arrays of the histogram bin boundaries in each dimension. See calchist ().

Scale –optional scale factor for the output back projection.

Whether normalization
Uniform –flag indicating whether the histogram is uniform or not (see above).


The functions Calcbackproject calculate the back project of the histogram. That's, similarly to 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 all element value in
Respect with the empirical probability distribution represented by the histogram. See how, for example, can find
and track a Bright-colored object in a scene:
1. Before tracking, show the object to the camera so, it covers almost the whole frame. Calculate a hue
Histogram. The histogram may has 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 the resulting picture and choose, for example, the largest component.
This is an approximate algorithm of the Camshift () Color Object Tracker.

How Reverse projection Works

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.