hough_lines_dir
接口
hough_lines_dir(ImageDir : HoughImage, Lines : DirectionUncertainty, AngleResolution, Smoothing, FilterSize, Threshold, AngleGap, DistGap, GenLines : Angle, Dist)
参数
in:
ImageDir :由边缘检测算子sobel_dir、edge_image获取的边缘梯度方向图
DirectionUncertainty:用于限定线内各点在边缘方向的运行变化程度。
AngleResolution:定义了确定角度的精确程度。精度总计为1/AngleResolution度。
Smoothing:用于选择平滑滤波器。
FilterSize:平滑滤波器的size,决定输出的平滑度。
Threshold:二值化阈值。
AngleGap、DistGap:参数AngleGap和DistGap定义了霍夫图像中的点的邻域,以确定局部最大值:AngleGap分别描述霍夫图像在角度方向上和在距离方向上的两个最大值的最小距离。
GenLines:bool值,用于决定是否在Lines中输出霍夫空间域中,有局部最大贡献值的区域。
out:
HoughImage:霍夫变换图像
Lines :输入图像中局部贡献值最大的区域(即检测到的直线区域)
Angle:检测到的直线的法向量角度(弧度制)
Dist:检测到的直线与原始位置的距离
示例程序
* Detect lines in an image with the help of the Hough transform
* using the edge direction as additional information and return it both
* in HNF and as regions
*
read_image (Image, 'fabrik')
rectangle1_domain (Image, ImageReduced, 170, 280, 310, 360)
* Detect edges (amplitude and direction) using the Sobel operator
sobel_dir (ImageReduced, EdgeAmplitude, EdgeDirection, 'sum_abs', 3)
dev_set_color ('red')
threshold (EdgeAmplitude, Region, 55, 255)
* Reduce the direction image to the edge region
reduce_domain (EdgeDirection, Region, EdgeDirectionReduced)
* Start the Hough transform using the edge direction information
hough_lines_dir (EdgeDirectionReduced, HoughImage, Lines, 4, 2, 'mean', 3, 25, 5, 5, 'true', Angle, Dist)
* Store input lines described in HNF
gen_region_hline (LinesHNF, Angle, Dist)
dev_display (Image)
dev_set_colored (12)
* Display the lines
dev_set_draw ('margin')
dev_display (LinesHNF)
* Display the edge pixels that contributed to the corresponding lines
dev_set_draw ('fill')
dev_display (Lines)