Documentation |
Find Cartesian coordinates of lines described by rho and theta pairs
The Hough Lines block finds the points of intersection between the reference image boundary lines and the line specified by a (rho, theta) pair. The block outputs one-based [x y] coordinates for the points of intersection. The boundary lines indicate the left and right vertical boundaries and the top and bottom horizontal boundaries of the reference image.
If the line specified by the (rho, theta) pair does not intersect two border lines in the reference image, the block outputs the values, [(0,0), (0,0)]. This output intersection value allows the next block in your model to ignore the points. Generally, the Hough Lines block precedes a block that draws a point or shape at the intersection.
The following figure shows the input and output coordinates for the Hough Lines block.
Port | Input/Output | Supported Data Types | Complex Values Supported |
---|---|---|---|
Theta | Vector of theta values that represent input lines |
| No |
Rho | Vector of rho values that represent input lines | Same as Theta port | No |
Ref I | Matrix that represents a binary or intensity image or matrix that represents one plane of an RGB image |
| No |
Pts | M-by-4 matrix of intersection values, where M is the number of input lines |
| No |
The Main pane of the Hough Lines dialog box appears as shown in the following figure.
If you select Trigonometric function, the block computes sine and cosine values to calculate the intersections of the lines during the simulation. If you select Table lookup, the block computes and stores the trigonometric values to calculate the intersections of the lines before the simulation starts. In this case, the block requires extra memory.
For floating-point inputs, set the Sine value computation method parameter to Trigonometric function. For fixed-point inputs, set the parameter to Table lookup.
Use this parameter to specify the spacing of the theta-axis. This parameter appears in the dialog box only if, for the Sine value computation method parameter, you select Table lookup. parameter appears in the dialog box.
The Data Types pane of the Hough Lines dialog box appears as shown in the following figure.
Select the rounding mode for fixed-point operations.
Select the overflow mode for fixed-point operations.
Choose how to specify the word length of the values of the sine table. The fraction length of the sine table values always equals the word length minus one:
When you select Specify word length, you can enter the word length of the sine table.
The sine table values do not obey the Rounding mode and Overflow mode parameters; they saturate and round to Nearest.
Use this parameter to specify how to designate this product output word and fraction lengths:
When you select Same as first input, the characteristics match the characteristics of the first input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the product output, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the product output. All signals in the Computer Vision System Toolbox™ blocks have a bias of 0.
See Multiplication Data Types for illustrations depicting the use of the product output.
Use this parameter to specify how you would like to designate the accumulator word and fraction lengths.
When you select Same as product output the characteristics match the characteristics of the product output.
When you select Binary point scaling, you can enter the Word length and the Fraction length of the accumulator, in bits.
When you select Slope and bias scaling, you can enter the Word length, in bits, and the Slope of the Accumulator. All signals in the Computer Vision System Toolbox software have a bias of 0.
See Multiplication Data Types for illustrations depicting the use of the accumulator data type in this block.
Select this parameter to prevent the fixed-point tools from overriding the data types you specify on the block mask. For more information, see fxptdlg, a reference page on the Fixed-Point Tool in the Simulink^{®} documentation.
The following figure shows Line 1 intersecting the boundaries of the reference image at [(x_{11}, y_{11}) (x_{12}, y_{12})] and Line 2 intersecting the boundaries at [(x_{21}, y_{21}) (x_{22}, y_{22})]
See Detect Lines in Images and Measure Angle Between Lines in the Computer Vision System Toolbox User Guide.