HALCON示例程序fin.hdev通过形态学检测缺陷
生活随笔
收集整理的這篇文章主要介紹了
HALCON示例程序fin.hdev通过形态学检测缺陷
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
HALCON示例程序fin.hdev通過形態(tài)學(xué)檢測缺陷
示例程序源碼(加注釋)
- 關(guān)于顯示類函數(shù)解釋
dev_update_window (‘off’)
read_image (Fins, ‘fin’ + [1:3])
get_image_size (Fins, Width, Height)
dev_close_window ()
dev_open_window (0, 0, Width[0], Height[0], ‘black’, WindowID)
set_display_font (WindowID, 14, ‘mono’, ‘true’, ‘false’)
for I := 1 to 3 by 1
select_obj (Fins, Fin, I)
dev_display (Fin)- 使用二進(jìn)制閾值分割圖像
binary_threshold (Fin, Background, ‘max_separability’, ‘light’, UsedThreshold)
dev_set_color (‘blue’)
dev_set_draw (‘margin’)
dev_set_line_width (4)
dev_display (Background)
disp_continue_message (WindowID, ‘black’, ‘true’)
stop () - 使用圓形元素進(jìn)行閉運(yùn)算
closing_circle (Background, ClosedBackground, 250)
dev_set_color (‘green’)
dev_display (ClosedBackground)
disp_continue_message (WindowID, ‘black’, ‘true’)
stop () - 求取區(qū)域不相交的區(qū)域
difference (ClosedBackground, Background, RegionDifference) - 使用矩形元素進(jìn)行開運(yùn)算
opening_rectangle1 (RegionDifference, FinRegion, 5, 5)
dev_display (Fin)
dev_set_color (‘red’)
dev_display (FinRegion)
area_center (FinRegion, FinArea, Row, Column)
if (I < 3)
disp_continue_message (WindowID, ‘black’, ‘true’)
stop ()
endif
endfor
- 使用二進(jìn)制閾值分割圖像
處理思路
這個(gè)例子是主要利用closing_circle、opening_rectangle1 前后的變換使用difference 求出差集,進(jìn)而提取出缺陷。
后記
大家有什么問題可以向我提問哈,我看到了第一時(shí)間回復(fù),希望在學(xué)習(xí)的路上多多結(jié)交良師益友。
總結(jié)
以上是生活随笔為你收集整理的HALCON示例程序fin.hdev通过形态学检测缺陷的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: windows启动winload.exe
- 下一篇: 20.链式队列