Operator Reference

hough_lines_dirT_hough_lines_dirHoughLinesDirHoughLinesDirhough_lines_dir (Operator)

hough_lines_dirT_hough_lines_dirHoughLinesDirHoughLinesDirhough_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

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)

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)

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)

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]]

Description

The operator hough_lines_dirhough_lines_dirHoughLinesDirHoughLinesDirhough_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 ImageDirImageDirImageDirimageDirimage_dir.

In contrast to hough_lineshough_linesHoughLinesHoughLineshough_lines, additionally the edge direction in ImageDirImageDirImageDirimageDirimage_dir (e.g., returned by sobel_dirsobel_dirSobelDirSobelDirsobel_dir or edges_imageedges_imageEdgesImageEdgesImageedges_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 DirectionUncertaintyDirectionUncertaintyDirectionUncertaintydirectionUncertaintydirection_uncertainty describes how much the edge direction of the individual points within a line is allowed to vary. For example, with DirectionUncertaintyDirectionUncertaintyDirectionUncertaintydirectionUncertaintydirection_uncertainty = 10 a horizontal line (i.e., edge direction = 0 degrees) may contain points with an edge direction between -10 and +10 degrees. The higher DirectionUncertaintyDirectionUncertaintyDirectionUncertaintydirectionUncertaintydirection_uncertainty is chosen, the higher the computation time will be. For DirectionUncertaintyDirectionUncertaintyDirectionUncertaintydirectionUncertaintydirection_uncertainty = 180 hough_lines_dirhough_lines_dirHoughLinesDirHoughLinesDirhough_lines_dir shows the same behavior as hough_lineshough_linesHoughLinesHoughLineshough_lines, i.e., the edge direction is ignored. DirectionUncertaintyDirectionUncertaintyDirectionUncertaintydirectionUncertaintydirection_uncertainty should be chosen at least as high as the step width of the edge direction stored in ImageDirImageDirImageDirimageDirimage_dir. The minimum step width is 2 degrees (defined by the image type 'direction').

The parameter AngleResolutionAngleResolutionAngleResolutionangleResolutionangle_resolution defines how accurately the angles are determined. The accuracy amounts to 1 / AngleResolutionAngleResolutionAngleResolutionangleResolutionangle_resolution degrees. A subsequent smoothing of the Hough space results in an increased stability. The smoothing filter can be selected by SmoothingSmoothingSmoothingsmoothingsmoothing, the degree of smoothing by the parameter FilterSizeFilterSizeFilterSizefilterSizefilter_size (see mean_imagemean_imageMeanImageMeanImagemean_image or gauss_imagegauss_imageGaussImageGaussImagegauss_image for details). The parameter ThresholdThresholdThresholdthresholdthreshold 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 AngleGapAngleGapAngleGapangleGapangle_gap and DistGapDistGapDistGapdistGapdist_gap define a neighborhood of the points in the Hough image in order to determine the local maxima: AngleGapAngleGapAngleGapangleGapangle_gap describes the minimum distance of two maxima in the Hough image in angle direction and DistGapDistGapDistGapdistGapdist_gap in distance direction, respectively. Thus, maxima exceeding ThresholdThresholdThresholdthresholdthreshold 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 HoughImageHoughImageHoughImagehoughImagehough_image, the lines are returned in Hessian Normal Form (HNF), that is by the direction AngleAngleAngleangleangle and length DistDistDistdistdist of their normal vectors. If the parameter GenLinesGenLinesGenLinesgenLinesgen_lines is set to 'true'"true""true""true""true", additionally those regions in ImageDirImageDirImageDirimageDirimage_dir are returned that contributed to the local maxima in Hough space. They are stored in the parameter LinesLinesLineslineslines.

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

ImageDirImageDirImageDirimageDirimage_dir (input_object)  singlechannelimage objectHImageHObjectHObjectHobject (direction)

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

HoughImageHoughImageHoughImagehoughImagehough_image (output_object)  image objectHImageHObjectHObjectHobject * (uint2)

Hough transform.

LinesLinesLineslineslines (output_object)  region-array objectHRegionHObjectHObjectHobject *

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

DirectionUncertaintyDirectionUncertaintyDirectionUncertaintydirectionUncertaintydirection_uncertainty (input_control)  angle.deg HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Uncertainty of edge direction (in degrees).

Default: 2

Value range: 2 ≤ DirectionUncertainty DirectionUncertainty DirectionUncertainty directionUncertainty direction_uncertainty ≤ 180

Minimum increment: 2

AngleResolutionAngleResolutionAngleResolutionangleResolutionangle_resolution (input_control)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

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

Default: 4

List of values: 1, 2, 4, 8

SmoothingSmoothingSmoothingsmoothingsmoothing (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Smoothing filter for hough image.

Default: 'mean' "mean" "mean" "mean" "mean"

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

FilterSizeFilterSizeFilterSizefilterSizefilter_size (input_control)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Required smoothing filter size.

Default: 5

List of values: 3, 5, 7, 9, 11

ThresholdThresholdThresholdthresholdthreshold (input_control)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Threshold value in the Hough image.

Default: 100

Value range: 1 ≤ Threshold Threshold Threshold threshold threshold

AngleGapAngleGapAngleGapangleGapangle_gap (input_control)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

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

Default: 5

Value range: 0 ≤ AngleGap AngleGap AngleGap angleGap angle_gap

DistGapDistGapDistGapdistGapdist_gap (input_control)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

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

Default: 5

Value range: 0 ≤ DistGap DistGap DistGap distGap dist_gap

GenLinesGenLinesGenLinesgenLinesgen_lines (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Create line regions if 'true'"true""true""true""true".

Default: 'true' "true" "true" "true" "true"

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

AngleAngleAngleangleangle (output_control)  hesseline.angle.rad-array HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

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

Value range: -1.5707963 ≤ Angle Angle Angle angle angle ≤ 3.1415927

DistDistDistdistdist (output_control)  hesseline.distance-array HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Distance of the detected lines from the origin.

Number of elements: Dist == Angle

Value range: 0 ≤ Dist Dist Dist dist dist

Result

The operator hough_lineshough_linesHoughLinesHoughLineshough_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>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)set_system("no_object_result",<Result>). If necessary an exception is raised.

Possible Predecessors

edges_imageedges_imageEdgesImageEdgesImageedges_image, sobel_dirsobel_dirSobelDirSobelDirsobel_dir, thresholdthresholdThresholdThresholdthreshold, nonmax_suppression_dirnonmax_suppression_dirNonmaxSuppressionDirNonmaxSuppressionDirnonmax_suppression_dir, reduce_domainreduce_domainReduceDomainReduceDomainreduce_domain, skeletonskeletonSkeletonSkeletonskeleton

Possible Successors

gen_region_hlinegen_region_hlineGenRegionHlineGenRegionHlinegen_region_hline, select_matching_linesselect_matching_linesSelectMatchingLinesSelectMatchingLinesselect_matching_lines

See also

hough_line_trans_dirhough_line_trans_dirHoughLineTransDirHoughLineTransDirhough_line_trans_dir, hough_line_transhough_line_transHoughLineTransHoughLineTranshough_line_trans, gen_region_hlinegen_region_hlineGenRegionHlineGenRegionHlinegen_region_hline, hough_circleshough_circlesHoughCirclesHoughCircleshough_circles

Module

Foundation