HALCON示例程序edge_segments.hdev提取连续的边缘段
HALCON示例程序edge_segments.hdev提取連續(xù)的邊緣段
示例程序源碼(加注釋)
-
關(guān)于顯示類函數(shù)解釋
dev_update_off ()
dev_close_window ()
read_image (Image, ‘mreut’)
get_image_size (Image, Width, Height)
dev_open_window_fit_image (Image, 0, 0, Width, Height, WindowID)
set_display_font (WindowID, 12, ‘mono’, ‘true’, ‘false’)
dev_set_draw (‘margin’)
dev_set_line_width (3)
dev_display (Image)
disp_continue_message (WindowID, ‘black’, ‘true’)
stop () -
edges_image - 使用Deriche,Lanser,Shen或Canny過濾器提取邊緣。
-
edges_image(圖片:邊緣幅度,邊緣方向:濾波器,高斯標(biāo)準(zhǔn)差,最大抑制,滯后閾值低值,滯后閾值高值 ?
edges_image (Image, ImaAmp, ImaDir, ‘lanser2’, 0.5, ‘nms’, 20, 40)
dev_display (ImaAmp)
disp_continue_message (WindowID, ‘black’, ‘true’)
stop () -
二值化提取邊緣
threshold (ImaAmp, Region, 1, 255) -
分割連通域
connection (Region, ConnectedRegions)
dev_clear_window ()
dev_set_colored (12)
dev_display (ConnectedRegions)
disp_continue_message (WindowID, ‘black’, ‘true’)
stop ()
dev_clear_window ()
count_obj (ConnectedRegions, Number) -
生成一個空的對象
gen_empty_obj (XLDContours)
for i := 1 to Number by 1- 選取指定圖像
select_obj (ConnectedRegions, SingleEdgeObject, i) - split_skeleton_lines - 根據(jù)線的曲率分割線段
- split_skeleton_lines(邊緣 :: 線的最大距離:起點行坐標(biāo),起點列坐標(biāo),終點行坐標(biāo),終點列坐標(biāo))
split_skeleton_lines (SingleEdgeObject, 2, BeginRow, BeginCol, EndRow, EndCol)
for k := 0 to |BeginRow| - 1 by 1- 這個是根據(jù)多個線段生成多邊形
gen_contour_polygon_xld (Contour, [BeginRow[k],EndRow[k]], [BeginCol[k],EndCol[k]])
concat_obj (XLDContours, Contour, XLDContours)
- 這個是根據(jù)多個線段生成多邊形
endfor
endfor
dev_display (XLDContours) - 選取指定圖像
處理思路
這個例子是主要講解了邊緣的提取與分割。edges_image、split_skeleton_lines 、gen_contour_polygon_xld
后記
大家有什么問題可以向我提問哈,我看到了第一時間回復(fù),希望在學(xué)習(xí)的路上多多結(jié)交良師益友。
總結(jié)
以上是生活随笔為你收集整理的HALCON示例程序edge_segments.hdev提取连续的边缘段的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 4.15
- 下一篇: .Net AppDomain详解(一)