hough_lines_dir — 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.
Image containing the edge direction. The edges are described by the image domain.
Regions of the input image that contributed to the local maxima.
Uncertainty of edge direction (in degrees).
Default value: 2
Typical range of values: 2 ≤ DirectionUncertainty ≤ 180
Minimum increment: 2
Resolution in the angle area (in 1/degrees).
Default value: 4
List of values: 1, 2, 4, 8
Smoothing filter for hough image.
Default value: 'mean'
List of values: 'gauss', 'mean', 'none'
Required smoothing filter size.
Default value: 5
List of values: 3, 5, 7, 9, 11
Threshold value in the Hough image.
Default value: 100
Typical range of values: 1 ≤ Threshold
Minimum distance of two maxima in the Hough image (direction: angle).
Default value: 5
Typical range of values: 0 ≤ AngleGap
Minimum distance of two maxima in the Hough image (direction: distance).
Default value: 5
Typical range of values: 0 ≤ DistGap
Create line regions if 'true'.
Default value: 'true'
List of values: 'false', 'true'
Angles (in radians) of the detected lines' normal vectors.
Typical range of values: -1.5707963 ≤ Angle ≤ 3.1415927
Distance of the detected lines from the origin.
Number of elements: Dist == Angle
Typical range of values: 0 ≤ Dist
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 is raised.
edges_image, sobel_dir, threshold, nonmax_suppression_dir, reduce_domain, skeleton
hough_line_trans_dir, hough_line_trans, gen_region_hline, hough_circles