Halcon学习---毛刺凸点检测
生活随笔
收集整理的這篇文章主要介紹了
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 1select_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總結
以上是生活随笔為你收集整理的Halcon学习---毛刺凸点检测的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: iphone ios 手势
- 下一篇: TimingExecutor —— 定时