0
点赞
收藏
分享

微信扫一扫

halcon 使用阈值分割提取轮廓 threshold_sub_pix

念川LNSC 2022-02-16 阅读 154

*在halcon中,使用阈值分割提取轮廓的算子是threshold_sub_pix

read_image(Image,'fabrik')
*图像分割
*灰度值在128和255之间的像素点作为同一个区域
threshold_(Image,Region,128,255)
*填充区域中的洞
fill_up(Region,RegionFillUp)
*连接区域,连在一起的作为一个区域,这样就将不连接的区域打散
connection(RegionFillUp, ConnectedRegions)
*按区域面积(以象素为单位的)选择目标区域
*这里我们要找到设备操作书的位置
select_shape(ConnectedRegions,SelectedRegions,'area','and',5000,10000)
*提取操作书区域的图像
reduce_domain(Image,SelectedRegions,ImageReduced)
*显示一下看效果
dev_clear_window()
dev_display(ImageReduced)
*在图像中使用阈值分割提取亚像素边缘轮廓
*以灰度值大于Threshold区域和灰度值小于Threshold的区域为分界点提取亚像素精密轮廓 
*原型:hreshold_sub_pix(Image : Border : Threshold : ) 
threshold_sub_pix(ImageReduced,Border,170)
*运行后如下图,可以在窗口看到目标图像中有一条彩色的先

*使用鼠标中间滚轮放大图像来看

举报

相关推荐

0 条评论