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

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