hough_lines_dir ( ImageDir : HoughImage, Lines : DirectionUncertainty, AngleResolution, Smoothing, FilterSize, Threshold, AngleGap, DistGap, GenLines : Angle, Dist )

Detect lines in edge images with the help of the Hough transform using local gradient direction and return them in normal form.

The operator hough_lines_dir selects line-like structures in a region based on the Hough transform. The individual points of a line can be unconnected. The region is given by the domain of ImageDir. The lines are returned in Hessian normal form (HNF), that is by the direction and length of their normal vector.

In contrast to hough_lines, additionally the edge direction in ImageDir (e.g., returned by sobel_dir or edges_image) is taken into account. This results in a more efficient computation and in a reduction of the noise in the Hough space.

The parameter DirectionUncertainty describes how much the edge direction of the individual points within a line is allowed to vary. For example, with DirectionUncertainty = 10 a horizontal line (i.e., edge direction = 0 degrees) may contain points with an edge direction between -10 and +10 degrees. The higher DirectionUncertainty is chosen, the higher the computation time will be. For DirectionUncertainty = 180 hough_lines_dir shows the same behavior as hough_lines, i.e., the edge direction is ignored. DirectionUncertainty should be chosen at least as high as the step width of the edge direction stored in ImageDir. The minimum step width is 2 degrees (defined by the image type 'direction').

The parameter AngleResolution defines how accurately the angles are determined. The accuracy amounts to 1 / AngleResolution degrees. A subsequent smoothing of the Hough space results in an increased stability. The smoothing filter can be selected by Smoothing, the degree of smoothing by the parameter FilterSize (see mean_image or gauss_image for details). The parameter Threshold determines by how many points of the original region a line's hypothesis must at least be supported in order to be selected into the output. The parameters AngleGap and DistGap define a neighborhood of the points in the Hough image in order to determine the local maxima: AngleGap describes the minimum distance of two maxima in the Hough image in angle direction and DistGap in distance direction, respectively. Thus, maxima exceeding Threshold but lying close to an even higher maximum are eliminated. This can particularly be helpful when searching for short and long lines simultaneously. Besides the unsmoothed Hough image HoughImage, the lines are returned in HNF (Angle, Dist). If the parameter GenLines is set to 'true', additionally those regions in ImageDir are returned that contributed to the local maxima in Hough space. They are stored in the parameter Lines.


Parameters

ImageDir (input_object)
image -> object : direction
Image containing the edge direction. The edges are described by the image domain.

HoughImage (output_object)
image -> object : uint2
Hough transform.

Lines (output_object)
region-array -> object
Regions of the input image that contributed to the local maxima.

DirectionUncertainty (input_control)
angle.deg -> integer
Uncertainty of edge direction (in degrees).
Default value: 2
Typical range of values: 2 <= DirectionUncertainty <= 180
Minimum increment: 2

AngleResolution (input_control)
integer -> integer
Resolution in the angle area (in 1/degrees).
Default value: 4
List of values: 1, 2, 4, 8

Smoothing (input_control)
string -> string
Smoothing filter for hough image.
Default value: 'mean'
List of values: 'none', 'mean', 'gauss'

FilterSize (input_control)
integer -> integer
Required smoothing filter size.
Default value: 5
List of values: 3, 5, 7, 9, 11

Threshold (input_control)
integer -> integer
Threshold value in the Hough image.
Default value: 100
Typical range of values: 1 <= Threshold

AngleGap (input_control)
integer -> integer
Minimum distance of two maxima in the Hough image (direction: angle).
Default value: 5
Typical range of values: 0 <= AngleGap

DistGap (input_control)
integer -> integer
Minimum distance of two maxima in the Hough image (direction: distance).
Default value: 5
Typical range of values: 0 <= DistGap

GenLines (input_control)
string -> string
Create line regions if 'true'.
Default value: 'true'
List of values: 'true', 'false'

Angle (output_control)
hesseline.angle.rad-array -> real
Angles (in radians) of the detected lines' normal vectors.
Typical range of values: -1.5707963 <= Angle <= 3.1415927

Dist (output_control)
hesseline.distance-array -> real
Distance of the detected lines from the origin.
Typical range of values: 0 <= Dist
Number of elements: Dist == Angle


Result

The operator hough_lines returns the value 2 (H_MSG_TRUE) if the input is not empty. The behavior in case of empty input (no input regions available) is set via the operator set_system('no_object_result',<Result>). If necessary an exception handling is raised.


Parallelization Information

hough_lines_dir is reentrant and processed without parallelization.


Possible Predecessors

edges_image, sobel_dir, threshold, nonmax_suppression_dir, reduce_domain, skeleton


Possible Successors

gen_region_hline, select_matching_lines


See also

hough_line_trans_dir, hough_line_trans, gen_region_hline, hough_circles


Module

Region processing



Copyright © 1996-2005 MVTec Software GmbH