图像阈值分割-自动阈值分割

图像阈值自动分割通过使用Halcon的auto_threshold算子实现,其原型如下:
auto_threshold(Image : Regions : Sigma : )

  • Image:输入的单通道图像
  • Regions:分割结果输出
  • Sigma:高斯模糊参数

auto_threshold使用多个阈值来分割单通道图像。

演示程序如下

* 图像阈值-Auto

* 读取图像
read_image(src,'../../../resources/images/cat.jpg')
get_image_size(src,width,height)
dev_close_window()
dev_open_window(0,0,width,height,'black',win_handle)
* 转换为灰度图像
rgb1_to_gray(src,gray)

auto_threshold(gray,region,2.4)
connection(region,connected_region)

dev_display(region)

更多推荐