HALCON Reference Manual 10.0.2
Table of Contents / Segmentation / Edges ClassesClassesClasses | | | Operators

detect_edge_segmentsT_detect_edge_segmentsdetect_edge_segmentsDetectEdgeSegmentsDetectEdgeSegments (Operator)

Name

detect_edge_segmentsT_detect_edge_segmentsdetect_edge_segmentsDetectEdgeSegmentsDetectEdgeSegments — Detect straight edge segments.

Signature

detect_edge_segments(Image : : SobelSize, MinAmplitude, MaxDistance, MinLength : BeginRow, BeginCol, EndRow, EndCol)

Herror T_detect_edge_segments(const Hobject Image, const Htuple SobelSize, const Htuple MinAmplitude, const Htuple MaxDistance, const Htuple MinLength, Htuple* BeginRow, Htuple* BeginCol, Htuple* EndRow, Htuple* EndCol)

Herror detect_edge_segments(Hobject Image, const HTuple& SobelSize, const HTuple& MinAmplitude, const HTuple& MaxDistance, const HTuple& MinLength, HTuple* BeginRow, HTuple* BeginCol, HTuple* EndRow, HTuple* EndCol)

HTuple HImage::DetectEdgeSegments(const HTuple& SobelSize, const HTuple& MinAmplitude, const HTuple& MaxDistance, const HTuple& MinLength, HTuple* BeginCol, HTuple* EndRow, HTuple* EndCol) const

HTuple HImageArray::DetectEdgeSegments(const HTuple& SobelSize, const HTuple& MinAmplitude, const HTuple& MaxDistance, const HTuple& MinLength, HTuple* BeginCol, HTuple* EndRow, HTuple* EndCol) const

void HOperatorSetX.DetectEdgeSegments(
[in] IHUntypedObjectX* Image, [in] VARIANT SobelSize, [in] VARIANT MinAmplitude, [in] VARIANT MaxDistance, [in] VARIANT MinLength, [out] VARIANT* BeginRow, [out] VARIANT* BeginCol, [out] VARIANT* EndRow, [out] VARIANT* EndCol)

VARIANT HImageX.DetectEdgeSegments(
[in] Hlong SobelSize, [in] Hlong MinAmplitude, [in] Hlong MaxDistance, [in] Hlong MinLength, [out] VARIANT* BeginCol, [out] VARIANT* EndRow, [out] VARIANT* EndCol)

static void HOperatorSet.DetectEdgeSegments(HObject image, HTuple sobelSize, HTuple minAmplitude, HTuple maxDistance, HTuple minLength, out HTuple beginRow, out HTuple beginCol, out HTuple endRow, out HTuple endCol)

void HImage.DetectEdgeSegments(int sobelSize, int minAmplitude, int maxDistance, int minLength, out HTuple beginRow, out HTuple beginCol, out HTuple endRow, out HTuple endCol)

Description

detect_edge_segmentsdetect_edge_segmentsdetect_edge_segmentsDetectEdgeSegmentsDetectEdgeSegments detects straight edge segments in the gray image ImageImageImageImageimage. The extracted edge segments are returned as line segments with start point (BeginRowBeginRowBeginRowBeginRowbeginRow,BeginColBeginColBeginColBeginColbeginCol) and end point (EndRowEndRowEndRowEndRowendRow,EndColEndColEndColEndColendCol). Edge detection is based on the Sobel filter, using 'sum_abs' as parameter and SobelSizeSobelSizeSobelSizeSobelSizesobelSize as the filter mask size (see sobel_ampsobel_ampsobel_ampSobelAmpSobelAmp). Only pixels with a filter response larger than MinAmplitudeMinAmplitudeMinAmplitudeMinAmplitudeminAmplitude are used as candidates for edge points. These thresholded edge points are thinned and split into straight segments. Due to technical reasons, edge points in which several edges meet are lost. Therefore, detect_edge_segmentsdetect_edge_segmentsdetect_edge_segmentsDetectEdgeSegmentsDetectEdgeSegments usually does not return closed object contours. The parameter MaxDistanceMaxDistanceMaxDistanceMaxDistancemaxDistance controls the maximum allowed distance of an edge point to its approximating line. For efficiency reasons, the sum of the absolute values of the coordinate differences is used instead of the Euclidean distance. MinLengthMinLengthMinLengthMinLengthminLength controls the minimum length of the line segments. Lines shorter than MinLengthMinLengthMinLengthMinLengthminLength are not returned.

Parallelization

Parameters

ImageImageImageImageimage (input_object)  (multichannel-)image(-array) objectHImageHImageHImageXHobject (byte)

Input image.

SobelSizeSobelSizeSobelSizeSobelSizesobelSize (input_control)  integer HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Mask size of the Sobel operator.

Default value: 5

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

MinAmplitudeMinAmplitudeMinAmplitudeMinAmplitudeminAmplitude (input_control)  integer HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Minimum edge strength.

Default value: 32

Suggested values: 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 80, 90, 100, 110

Typical range of values: 1 ≤ MinAmplitude MinAmplitude MinAmplitude MinAmplitude minAmplitude ≤ 255

Minimum increment: 1

Recommended increment: 1

Restriction: MinAmplitude >= 0

MaxDistanceMaxDistanceMaxDistanceMaxDistancemaxDistance (input_control)  integer HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Maximum distance of the approximating line to its original edge.

Default value: 3

Suggested values: 2, 3, 4, 5, 6, 7, 8

Typical range of values: 1 ≤ MaxDistance MaxDistance MaxDistance MaxDistance maxDistance ≤ 30

Minimum increment: 1

Recommended increment: 1

Restriction: MaxDistance >= 0

MinLengthMinLengthMinLengthMinLengthminLength (input_control)  integer HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Minimum length of to resulting line segments.

Default value: 10

Suggested values: 3, 5, 7, 9, 11, 13, 16, 20

Typical range of values: 1 ≤ MinLength MinLength MinLength MinLength minLength ≤ 500

Minimum increment: 1

Recommended increment: 1

Restriction: MinLength >= 0

BeginRowBeginRowBeginRowBeginRowbeginRow (output_control)  line.begin.y-array HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Row coordinate of the line segments' start points.

BeginColBeginColBeginColBeginColbeginCol (output_control)  line.begin.x-array HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Column coordinate of the line segments' start points.

EndRowEndRowEndRowEndRowendRow (output_control)  line.end.y-array HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Row coordinate of the line segments' end points.

EndColEndColEndColEndColendCol (output_control)  line.end.x-array HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Column coordinate of the line segments' end points.

Example (C)

Htuple  SobelSize,MinAmplitude,MaxDistance,MinLength;
Htuple  RowBegin,ColBegin,RowEnd,ColEnd;

create_tuple(&SobelSize,1);
set_i(SobelSize,5,0);
create_tuple(&MinAmplitude,1);
set_i(MinAmplitude,32,0);
create_tuple(&MaxDistance,1);
set_i(MaxDistance,3,0);
create_tuple(&MinLength,1);
set_i(MinLength,10,0);
T_detect_edge_segments(Image,SobelSize,MinAmplitude,MaxDistance,MinLength,
                &RowBegin,&ColBegin,&RowEnd,&ColEnd);

Result

detect_edge_segmentsdetect_edge_segmentsdetect_edge_segmentsDetectEdgeSegmentsDetectEdgeSegments returns 2 (H_MSG_TRUE) if all parameters are correct. If the input is empty the behaviour can be set via set_system('no_object_result',<Result>)set_system("no_object_result",<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>). If necessary, an exception is raised.

Possible Predecessors

sigma_imagesigma_imagesigma_imageSigmaImageSigmaImage, median_imagemedian_imagemedian_imageMedianImageMedianImage

Possible Successors

select_linesselect_linesselect_linesSelectLinesSelectLines, partition_linespartition_linespartition_linesPartitionLinesPartitionLines, select_lines_longestselect_lines_longestselect_lines_longestSelectLinesLongestSelectLinesLongest, line_positionline_positionline_positionLinePositionLinePosition, line_orientationline_orientationline_orientationLineOrientationLineOrientation

Alternatives

sobel_ampsobel_ampsobel_ampSobelAmpSobelAmp, thresholdthresholdthresholdThresholdThreshold, skeletonskeletonskeletonSkeletonSkeleton

Module

Foundation


Table of Contents / Segmentation / Edges ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH