Skip to content

hough_lines_dirHoughLinesDirHoughLinesDirhough_lines_dirT_hough_lines_dirπŸ”—

Short descriptionπŸ”—

hough_lines_dirHoughLinesDirHoughLinesDirhough_lines_dirT_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.

SignatureπŸ”—

hough_lines_dir( image ImageDir, out image HoughImage, out region Lines, angle.deg DirectionUncertainty, integer AngleResolution, string Smoothing, integer FilterSize, integer Threshold, integer AngleGap, integer DistGap, string GenLines, out hesseline.angle.rad Angle, out hesseline.distance Dist )void HoughLinesDir( const HObject& ImageDir, HObject* HoughImage, HObject* Lines, const HTuple& DirectionUncertainty, const HTuple& AngleResolution, const HTuple& Smoothing, const HTuple& FilterSize, const HTuple& Threshold, const HTuple& AngleGap, const HTuple& DistGap, const HTuple& GenLines, HTuple* Angle, HTuple* Dist )static void HOperatorSet.HoughLinesDir( HObject imageDir, out HObject houghImage, out HObject lines, HTuple directionUncertainty, HTuple angleResolution, HTuple smoothing, HTuple filterSize, HTuple threshold, HTuple angleGap, HTuple distGap, HTuple genLines, out HTuple angle, out HTuple dist )def hough_lines_dir( image_dir: HObject, direction_uncertainty: int, angle_resolution: int, smoothing: str, filter_size: int, threshold: int, angle_gap: int, dist_gap: int, gen_lines: str ) -> Tuple[HObject, HObject, Sequence[float], Sequence[float]]

Herror T_hough_lines_dir( const Hobject ImageDir, Hobject* HoughImage, Hobject* Lines, const Htuple DirectionUncertainty, const Htuple AngleResolution, const Htuple Smoothing, const Htuple FilterSize, const Htuple Threshold, const Htuple AngleGap, const Htuple DistGap, const Htuple GenLines, Htuple* Angle, Htuple* Dist )

HImage HImage::HoughLinesDir( HRegion* Lines, Hlong DirectionUncertainty, Hlong AngleResolution, const HString& Smoothing, Hlong FilterSize, Hlong Threshold, Hlong AngleGap, Hlong DistGap, const HString& GenLines, HTuple* Angle, HTuple* Dist ) const

HImage HImage::HoughLinesDir( HRegion* Lines, Hlong DirectionUncertainty, Hlong AngleResolution, const char* Smoothing, Hlong FilterSize, Hlong Threshold, Hlong AngleGap, Hlong DistGap, const char* GenLines, HTuple* Angle, HTuple* Dist ) const

HImage HImage::HoughLinesDir( HRegion* Lines, Hlong DirectionUncertainty, Hlong AngleResolution, const wchar_t* Smoothing, Hlong FilterSize, Hlong Threshold, Hlong AngleGap, Hlong DistGap, const wchar_t* GenLines, HTuple* Angle, HTuple* Dist ) const (Windows only)

HImage HImage.HoughLinesDir( out HRegion lines, int directionUncertainty, int angleResolution, string smoothing, int filterSize, int threshold, int angleGap, int distGap, string genLines, out HTuple angle, out HTuple dist )

DescriptionπŸ”—

The operator hough_lines_dirHoughLinesDir 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 ImageDirimageDirimage_dir.

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

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

The parameter AngleResolutionangleResolutionangle_resolution defines how accurately the angles are determined. The accuracy amounts to \(1 / \textrm{AngleResolution}\) degrees. A subsequent smoothing of the Hough space results in an increased stability. The smoothing filter can be selected by Smoothingsmoothingsmoothing, the degree of smoothing by the parameter FilterSizefilterSizefilter_size (see mean_imageMeanImage or gauss_imageGaussImage for details). The parameter Thresholdthresholdthreshold 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 AngleGapangleGapangle_gap and DistGapdistGapdist_gap define a neighborhood of the points in the Hough image in order to determine the local maxima: AngleGapangleGapangle_gap describes the minimum distance of two maxima in the Hough image in angle direction and DistGapdistGapdist_gap in distance direction, respectively. Thus, maxima exceeding Thresholdthresholdthreshold but lying close to an even higher maximum are eliminated. If multiple maxima in this neighborhood are equally high, all of them are returned. This elimination can particularly be helpful when searching for short and long lines simultaneously. Besides the not smoothed Hough image HoughImagehoughImagehough_image, the lines are returned in Hessian Normal Form (HNF), that is by the direction Angleangleangle and length Distdistdist of their normal vectors. If the parameter GenLinesgenLinesgen_lines is set to 'true'"true", additionally those regions in ImageDirimageDirimage_dir are returned that contributed to the local maxima in Hough space. They are stored in the parameter Lineslineslines.

Execution informationπŸ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

ParametersπŸ”—

ImageDirimageDirimage_dir (input_object) singlechannelimage β†’ object (direction)HObject (direction)HImage (direction)HObject (direction)Hobject (direction)

Image containing the edge direction. The edges are described by the image domain.

HoughImagehoughImagehough_image (output_object) image β†’ object (uint2)HObject (uint2)HImage (uint2)HObject (uint2)Hobject * (uint2)

Hough transform.

Lineslineslines (output_object) region-array β†’ objectHObjectHRegionHObjectHobject *

Regions of the input image that contributed to the local maxima.

DirectionUncertaintydirectionUncertaintydirection_uncertainty (input_control) angle.deg β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Uncertainty of edge direction (in degrees).

Default: 22
Value range: 2 ≀ DirectionUncertainty ≀ 180
Minimum increment: 2

AngleResolutionangleResolutionangle_resolution (input_control) integer β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Resolution in the angle area (in 1/degrees).

Default: 44
List of values: 1, 2, 4, 81, 2, 4, 8

Smoothingsmoothingsmoothing (input_control) string β†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Smoothing filter for hough image.

Default: 'mean'"mean"
List of values: 'gauss', 'mean', 'none'"gauss", "mean", "none"

FilterSizefilterSizefilter_size (input_control) integer β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Required smoothing filter size.

Default: 55
List of values: 3, 5, 7, 9, 113, 5, 7, 9, 11

Thresholdthresholdthreshold (input_control) integer β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Threshold value in the Hough image.

Default: 100100
Value range: 1 ≀ Threshold

AngleGapangleGapangle_gap (input_control) integer β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Minimum distance of two maxima in the Hough image (direction: angle).

Default: 55
Value range: 0 ≀ AngleGap

DistGapdistGapdist_gap (input_control) integer β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Minimum distance of two maxima in the Hough image (direction: distance).

Default: 55
Value range: 0 ≀ DistGap

GenLinesgenLinesgen_lines (input_control) string β†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Create line regions if 'true'"true".

Default: 'true'"true"
List of values: 'false', 'true'"false", "true"

Angleangleangle (output_control) hesseline.angle.rad-array β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Angles (in radians) of the detected lines’ normal vectors.

Value range: -1.5707963 ≀ Angle ≀ 3.1415927

Distdistdist (output_control) hesseline.distance-array β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Distance of the detected lines from the origin.

Number of elements: Dist == Angle
Value range: 0 ≀ Dist

ResultπŸ”—

The operator hough_linesHoughLines 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.

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

edges_imageEdgesImage, sobel_dirSobelDir, thresholdThreshold, nonmax_suppression_dirNonmaxSuppressionDir, reduce_domainReduceDomain, skeletonSkeleton

Possible successors

gen_region_hlineGenRegionHline, select_matching_linesSelectMatchingLines

See also

hough_line_trans_dirHoughLineTransDir, hough_line_transHoughLineTrans, gen_region_hlineGenRegionHline, hough_circlesHoughCircles

ModuleπŸ”—

Foundation