Académique Documents
Professionnel Documents
Culture Documents
6. Contours
http://howto.nicubunu.ro/gears/gears_16.png
www.uralvision.blogspot.com perevalovds@gmail.com
USU / IMM Fall 2010
The concept of contour
The concept of contour
Contour of the object - A line that represents the edge forms object.
If there is a partition of the image into regions corresponding to different objects, their
external contours can be specified uniquely.
To indicate Interior contours need 3d model of the object. In this case, the contours are the
projection of the image lines of bending 3d object.
http://cvpr.uni-muenster.de/research/rack/index.html
The concept of contour
If given the image that should be allocated contours
but No no partition on the field, no 3d-models
then there ambiguity determine what the circuit
associated with
-scale (How small objects of interest)
-texture (Whether the contours of the elements of texture)
-semantics (Sometimes the line in the image are simply painted on site, and do not reflect
the bending of its shape)
Contour in the image - this is the line along which a jump in brightness or color.
Contours on image moreThan the contours of objects in the image. Therefore, after solving
the problem of finding contours in an image made them an additional analysis to identify
the contours of objects of interest.
Why do I need to find the contour
1. Recognition
2. Measurements
Please note that only show positive values. Negative and zero values - are shown in black.
Sobel filter
Example, continued
Mat binary;
threshold (contImg, binary, 0.7, 1.0, CV_THRESH_BINARY);
Sobel filter
Example, continued
Other filters underscore the contour
points
1. Scharr (),
2. Laplacian (),
3. difference of two Gaussians (see the lecture about smoothing).
All the methods considered this shortcoming: they work at the level of individual pixels,
and so get the contours are not continuous smooth lines.
The idea - to trace the contour of moving along the points with
a maximum value of "loop".
The output of the algorithm gives a binary image with the found
pixels corresponding to the contours.
Canny edge detector
void Canny(Const Mat & image //Input image, 1-channel, 8-bit
Mat & edges, //Output image
double threshold1, //Thresholds, the highest - for contour seed
double threshold2, //Smallest - for contour joins
int apertureSize= 3, //window for the Sobel filter
bool L2gradient=false //whether to use the Euclidean length of vector
// as Sobel, sqrt (dx * dx + dy * dy),
// or simply | dx | + | dy |
);
Canny edge detector
Example
Mat imageGray, edges;
cvtColor (image, imageGray, CV_RGB2GRAY);
Canny (imageGray, edges, 230, 150);
Values mode:
CV_RETR_EXTERNAL - Only the outer contours
CV_RETR_LIST - List all units
Used another form of features, see the documentation:
CV_RETR_CCOMP - 2-level hierarchy - the outer boundaries and holes
CV_RETR_TREE - is a tree of nested loops,
Values method:
CV_CHAIN_APPROX_NONE- Without approximation
CV_CHAIN_APPROX_SIMPLE - vybrasyavaet horizontal and vertical points within the segments
CV_CHAIN_APPROX_TC89_L1, CV_CHAIN_APPROX_TC89_KCOS - approximation methodTeh-Chin
Tracing the contours
Example
vector <vector <Point>> contours;
findContours (edges, contours, CV_RETR_LIST, CV_CHAIN_APPROX_TC89_L1);
Also, the statistical moments and Fourier transform algorithms for direct
comparison of the contours.
Problems
- If the object is essentially three-dimensional, then its outer contour can vary
during the rotation of the object.
- If the object is blocked by another object, it adds complexity to the recognition
algorithm.