本文主要围绕Halcon的边缘提取中的一个算子get_region_contour展开学习
1.get_region_contour
该算子检测图像中线条及其宽度被广泛应用;
Signature
get_region_contour(Region: : :Rows,Columns)
Region:(input_object)输入图像的感兴趣区域
Rows:(output_control) 轮廓的Y的坐标点
Columns:(output_control) 轮廓的X坐标点
Halcon例程1:
提取前图片:
dev_close_window ()
read_image (Image, 'mreut')
dev_open_window (0, 0, 512, 512, 'white', WindowID)
dev_display (Image)
dev_set_color ('black')
threshold (Image, Region, 180, 255)
dev_clear_window ()
dev_display (Region)
connection (Region, ConnectedRegions)
select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 10000, 100000000)
get_region_contour (SelectedRegions, Rows, Columns)
RowLine1 := 5
ColLine1 := 300
RowLine2 := 300
ColLine2 := 400
NumberTuple := |Rows|
dev_set_color ('red')
disp_line (WindowID, RowLine1, ColLine1, RowLine2, ColLine2)
dev_set_color ('green')
* Calculate the distance between points of the contour
* of the selected region and the displayed line</