HALCON示例程序fin.hdev通过形态学检测缺陷
生活随笔
收集整理的這篇文章主要介紹了
HALCON示例程序fin.hdev通过形态学检测缺陷
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
HALCON示例程序fin.hdev通過形態學檢測缺陷
示例程序源碼(加注釋)
- 關于顯示類函數解釋
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)- 使用二進制閾值分割圖像
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 () - 使用圓形元素進行閉運算
closing_circle (Background, ClosedBackground, 250)
dev_set_color (‘green’)
dev_display (ClosedBackground)
disp_continue_message (WindowID, ‘black’, ‘true’)
stop () - 求取區域不相交的區域
difference (ClosedBackground, Background, RegionDifference) - 使用矩形元素進行開運算
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
- 使用二進制閾值分割圖像
處理思路
這個例子是主要利用closing_circle、opening_rectangle1 前后的變換使用difference 求出差集,進而提取出缺陷。
后記
大家有什么問題可以向我提問哈,我看到了第一時間回復,希望在學習的路上多多結交良師益友。
總結
以上是生活随笔為你收集整理的HALCON示例程序fin.hdev通过形态学检测缺陷的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: windows启动winload.exe
- 下一篇: Win10系统winload.efi丢失