打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
halcon学习之边缘提取5

5, derivate_gauss.hdev  

a)高斯导数滤波用作 平滑滤波器(使用分水岭watershed得到contours)(用于很多小块的图像)
read_image...
derivate_gauss(Meningg5,Smoothed, 2, 'none')
derivate_gauss(Image : DerivGauss(这里指输出图像) : Sigma, Component : )
用一个图片Image和一个高斯函数的导数求卷积,从而计算出不同的特征值。sigma控制高斯函数,当sigma为一个值时候,行和列的方向上sigma相同,当sigma为两个值时候,第一个控制列的程度,第二个控制行的程度。‘none’这里指Smoothing only,其余参数请自行查看帮助文档。

convert_image_type(Smoothed, SmoothedByte,'byte')
convert_image_type(Image : ImageConverted : NewType : )转换图像类型

watersheds(SmoothedByte, Basins, Watersheds)
watersheds(Image : Basins, Watersheds : : )
找出图片的分水岭和凹陷块区域,用于图片分割

b) 高斯导数滤波用作边缘检测
read_image....
derivate_gauss(Image,GradientAmp1, 1.5,'gradient')
threshold....

c) 高斯导数滤波用作角检测?
derivate(Image, Det, 1.5, 'det')
threshold(Det, Corners, 20, 1000000)

d ) 高斯导数滤波用作边缘检测( 二阶导数)
derivate_gauss(Image, EdgesAreZero, 3, '2nd_ddg')
zero_crossing(EdgesAreZero, Edges)
zero_crossing returns the zero crossings of the input image as a region. A pixel is accepted as a zero crossing if its gray value (in Image) is zero, or if at least one of its neighbors of the 4-neighborhood has a different sign.

This operator is intended to be used after edge operators returning the second derivative of the image (e.g., laplace_of_gauss), which were possibly followed by a smoothing operator. In this case, the zero crossings are (candidates for) edges.)


6, 各种滤波

diff_of_gauss        +              zero_crossing

laplace_of_gauss   +             zero_crossing

derivate_gauss      +             zero_crossing   

7,显示一个保存边界的XLD对象

read_image
edges_sub_pix(Image,Edges, 'mderiche2', 0.7, 10,20)
edges_sub_pix(Image : Edges : Filter, Alpha, Low, High : )
使用Deriche, Lanser, Shen, or Canny滤波器来精确检测边缘

edges_image(Image, ImaAmp, ImaDir,'mderiche2', 0.7,'nms',10, 20)
使用Deriche, Lanser, Shen, or Canny滤波器来检测边缘,并得到边缘的幅值和方向

count_seconds(a1)  记录当前时间
disp_xld(Edges, WindowID)
count_seconds(a2)
Time:=a2-a1
记录执行下面一步所用的时间

8, edge_segments.hdev 边缘分割
read_image...
get_image_size(Image, Width, Height)
dev_open_window_fit_image
显示
edges_image(Image, ImaAmp, ImaDir,'lanser2', 0.5,'nms',20, 40)  
lanser精度很高, 用来计算边界

threshold
connection
用来提取出边界

边界的显示:
count_obj(ConnectedRegions, Number)
gen_empty_obj(XLDContours)   用来存储边界
for i:=1 to Number by 1
         select_obj(ConnectedRegions, SingleEdgeObject, i)
                      select_obj(Objects : ObjectSelected : Index : )

         split_skeleton_lines(SingleEdgeObject, 2, BeginRow, BeginCol, EndRow, EndCol)

split_skeleton_lines(SkeletonRegion : : MaxDistance : BeginRow, BeginCol, EndRow, EndCol)

  寻找骨骼线,删除小分支,得到骨骼线的头和尾节点,主意这里可能产生的头和尾是一个数组,其中可能有多个头节点和尾节点

         for k:= 0 to |BeginRow|-1 by 1
         gen_contour_polygon_xld( Contour,[BeginRow[k], endRow[k]], [BeginCol[k], EndCol[k]])
         concat_obj(XLDContours, Contour, XLDContours)
         concat_obj(Objects1, Objects2 : ObjectsConcat : : )
          把两个对象连起来
         endfor
endfor


本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Halcon学习之边缘检测函数
《HALCON机器视觉与算法原理编程实践》第10章 边缘检测
基于OpenCV的图像卡通化
深度学习中的激活函数与梯度消失
Image Registration and Mosaicking
halcon学习笔记-机器视觉工程应用的开发思路
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服