Halcon 分水嶺算法圖像分割

上結果:
在這裏插入圖片描述
原圖如下:
在這裏插入圖片描述
上代碼:

dev_set_draw ('fill')
dev_set_line_width (2)
dev_set_colored (12)

read_image (ImageLogo, 'D:/HalconWorkplace/img/NBA logo.jpg')
dev_close_window ()
get_image_size (ImageLogo, Width, Height)
dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
dev_display (ImageLogo)
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
*高斯平滑濾波
gauss_filter (ImageLogo, ImageGauss, 9)
*計算圖像邊緣幅度
sobel_amp (ImageGauss, EdgeAmplitude, 'sum_abs', 3)

disp_continue_message (WindowHandle, 'black', 'true')
stop ()
*通過閾值實現圖像的分水嶺算法分割
watersheds_threshold (EdgeAmplitude, Basins, 14)
dev_display (Basins)
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
return ()

參考

https://blog.csdn.net/Vichael_Chan/article/details/102576060
https://blog.csdn.net/liubing8609/article/details/85373420

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章