Chapter 6-image transformation-Hov Line Transformation (cvhoughlines2)

Source: Internet
Author: User

Hof transformation is a method for finding straight lines, circles, and other simple shapes in an image. Hof line transformation is to find a straight line in a binary image by using Hof transformation.

Using cv_hough_probabilistic, corresponding to ppht (cumulative probability Hof transformation )? The specific implementation of this algorithm is to be further explored !!!

Bytes ----------------------------------------------------------------------------------------------------

The HOF line transformation function is:

Houghlines

Finding a straight line in a binary image using the Hough Transform

CvSeq* cvHoughLines2( CvArr* image, void* line_storage, int method, double rho, double theta, int threshold, double param1=0, double param2=0 );
Image
Input an 8-bit, single-channel (Binary) image. When the cv_hough_probabilistic method is used to detect the image, its content is changed by the function.
Line_storage
The detected Line Segment Storage warehouse. it can be a memory storage warehouse (in this case, a line segment sequence is created in the storage warehouse and returned by the function) or a special type that contains line segment parameters (see below) has a single row/single column matrix (cvmat *). The matrix header is modified by the function so that its Cols/rows contains a group of detected line segments. If line_storage is a matrix, and the actual number of line segments exceeds the matrix size, the maximum number of lines may be returned (for standard Hough transformation, the line segments are output in descending order of length ).
Method
One of the following variables is the Hough variable:

  • Cv_hough_standard-traditional or standard Hough transformation. each line segment is represented by two floating point numbers (p, θ), where p is the distance between the line and the origin (0, 0), and the angle between the θ line segment and the x-axis. Therefore, the matrix type must be cv_32fc2 type.
  • Cv_hough_probabilistic-probabilistic Hough Transformation (if the image contains long linear segmentation, it is more efficient). It returns the line segment instead of the entire line segment. Each split is expressed by the start and end points. Therefore, the matrix (or the sequence created) type is cv_32sc4.
  • Cv_hough_multi_scale-multi-scale variant of the traditional hough transformation. The line segment is encoded in the same way as cv_hough_standard.
Rock
Distance Precision of pixel-related units
Theta
Angle accuracy of radian Measurement
Threshold
Threshold parameter. If the cumulative value is greater than threshold, the line segment returned by the function.
Param1
Parameters related to the first method:

  • Do not use (0) for traditional Hough transformations ).
  • This is the minimum line segment length.
  • For the multi-scale hough transformation, it is the denominator of the Distance Precision, and the approximate distance precision is, and the precise precision should be ).
Param2
Parameters related to the second method:

  • Do not use (0) for traditional Hough transformations ).
  • This parameter indicates the maximum gap between broken line segments in the same line ), that is, when the interval between two broken lines in the same line is less than param2, combine them into one.
  • For multi-scale hough transformation, it is the denominator of angle precision theta (the approximate angle precision is Theta, and the precise angle should be Theta/param2 ).

The cvhoughlines2 function implements different methods for Line Segment Detection. Example.

Bytes ----------------------------------------------------------------------------------------------------

/* Code */

Cvcvtcolor color space conversion is used in the program to convert the input image from a color space to another color space. The system uses a single-channel image, which is then converted to a three-channel image, and then uses the Hough transformation.

# Include 

Bytes ----------------------------------------------------------------------------------------------------
/* Result */

SRC

Hough line

As shown in the figure, green lines are used to sketch all the straight lines after being detected by the canny contour, and then transformed by the Hough line.

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.