detect_edge_segmentsT_detect_edge_segmentsDetectEdgeSegmentsDetectEdgeSegmentsdetect_edge_segments (算子)

名称

detect_edge_segmentsT_detect_edge_segmentsDetectEdgeSegmentsDetectEdgeSegmentsdetect_edge_segments — 检测直边段。

签名

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)

void DetectEdgeSegments(const HObject& Image, const HTuple& SobelSize, const HTuple& MinAmplitude, const HTuple& MaxDistance, const HTuple& MinLength, HTuple* BeginRow, HTuple* BeginCol, HTuple* EndRow, HTuple* EndCol)

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

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)

def detect_edge_segments(image: HObject, sobel_size: int, min_amplitude: int, max_distance: int, min_length: int) -> Tuple[Sequence[int], Sequence[int], Sequence[int], Sequence[int]]

描述

detect_edge_segmentsdetect_edge_segmentsDetectEdgeSegmentsDetectEdgeSegmentsDetectEdgeSegmentsdetect_edge_segments detects straight edge segments in the gray image ImageImageImageImageimageimage. The extracted edge segments are returned as line segments with start point (BeginRowBeginRowBeginRowBeginRowbeginRowbegin_row,BeginColBeginColBeginColBeginColbeginColbegin_col) and end point (EndRowEndRowEndRowEndRowendRowend_row,EndColEndColEndColEndColendColend_col). Edge detection is based on the Sobel filter, using 'sum_abs'"sum_abs""sum_abs""sum_abs""sum_abs""sum_abs" as parameter and SobelSizeSobelSizeSobelSizeSobelSizesobelSizesobel_size as the filter mask size (see sobel_ampsobel_ampSobelAmpSobelAmpSobelAmpsobel_amp). Only pixels with a filter response larger than MinAmplitudeMinAmplitudeMinAmplitudeMinAmplitudeminAmplitudemin_amplitude 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_segmentsDetectEdgeSegmentsDetectEdgeSegmentsDetectEdgeSegmentsdetect_edge_segments usually does not return closed object contours. The parameter MaxDistanceMaxDistanceMaxDistanceMaxDistancemaxDistancemax_distance 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. MinLengthMinLengthMinLengthMinLengthminLengthmin_length controls the minimum length of the line segments. Lines shorter than MinLengthMinLengthMinLengthMinLengthminLengthmin_length are not returned.

注意

请注意,若使用域缩减后的图像作为输入,滤波器算子可能会返回意外结果。请参阅 滤波器 一章

执行信息

参数

ImageImageImageImageimageimage (输入对象)  (multichannel-)image(-array) objectHImageHObjectHImageHobject (byte)

输入图像。

SobelSizeSobelSizeSobelSizeSobelSizesobelSizesobel_size (输入控制)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Mask size of the Sobel operator.

默认值: 5

值列表: 3, 5, 7, 9, 11, 13

MinAmplitudeMinAmplitudeMinAmplitudeMinAmplitudeminAmplitudemin_amplitude (输入控制)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Minimum edge strength.

默认值: 32

建议值: 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 80, 90, 100, 110

值范围: 1 ≤ MinAmplitude MinAmplitude MinAmplitude MinAmplitude minAmplitude min_amplitude ≤ 255

最小增量: 1

建议增量: 1

MaxDistanceMaxDistanceMaxDistanceMaxDistancemaxDistancemax_distance (输入控制)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Maximum distance of the approximating line to its original edge.

默认值: 3

建议值: 2, 3, 4, 5, 6, 7, 8

值范围: 0 ≤ MaxDistance MaxDistance MaxDistance MaxDistance maxDistance max_distance

最小增量: 1

建议增量: 1

MinLengthMinLengthMinLengthMinLengthminLengthmin_length (输入控制)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Minimum length of to resulting line segments.

默认值: 10

建议值: 3, 5, 7, 9, 11, 13, 16, 20

值范围: 1 ≤ MinLength MinLength MinLength MinLength minLength min_length

最小增量: 1

建议增量: 1

BeginRowBeginRowBeginRowBeginRowbeginRowbegin_row (输出控制)  line.begin.y-array HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Row coordinate of the line segments' start points.

BeginColBeginColBeginColBeginColbeginColbegin_col (输出控制)  line.begin.x-array HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Column coordinate of the line segments' start points.

EndRowEndRowEndRowEndRowendRowend_row (输出控制)  line.end.y-array HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Row coordinate of the line segments' end points.

EndColEndColEndColEndColendColend_col (输出控制)  line.end.x-array HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Column coordinate of the line segments' end points.

示例(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);

结果

detect_edge_segmentsdetect_edge_segmentsDetectEdgeSegmentsDetectEdgeSegmentsDetectEdgeSegmentsdetect_edge_segments 在所有参数正确时返回 2 ( H_MSG_TRUE )。 如果输入为空则可设置行为通过 set_system('no_object_result',<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)set_system("no_object_result",<Result>)。如有必要,则抛出异常。

可能的前趋

sigma_imagesigma_imageSigmaImageSigmaImageSigmaImagesigma_image, median_imagemedian_imageMedianImageMedianImageMedianImagemedian_image

可能的后继

partition_linespartition_linesPartitionLinesPartitionLinesPartitionLinespartition_lines, line_positionline_positionLinePositionLinePositionLinePositionline_position, line_orientationline_orientationLineOrientationLineOrientationLineOrientationline_orientation

替代

sobel_ampsobel_ampSobelAmpSobelAmpSobelAmpsobel_amp, thresholdthresholdThresholdThresholdThresholdthreshold, skeletonskeletonSkeletonSkeletonSkeletonskeleton

模块

基础