QQ登录

只需一步,快速开始

halcon zero_crossing函数介绍

[ 复制链接 ]
zero_crossing(Image : RegionCrossing : : )
zero_crossing将输入图像Image的零交叉作为区域返回。
如果一个像素的灰度值(在Image 中)为零,
或者它的4个邻域中至少有一个邻域有不同的符号,那么它就被看作为一个零交叉。


通常在调用边缘操作符,返回图像的二阶导数(例如laplace_of_gauss)之后才使用这个函数
后面可能会跟着一个平滑操作符。
这种情况下,零交叉就是(候选的)边缘。


例如可以运行下载代码查看每次调用函数的效果:
read_image (Image, 'mreut')
laplace (Image, ImageLaplace_3, 'signed', 3, 'n_8_isotropic')
zero_crossing (ImageLaplace_3, RegionCrossing_3)
laplace (Image, ImageLaplace_11, 'signed', 11, 'n_8_isotropic')
zero_crossing (ImageLaplace_11, RegionCrossing_11)
laplace_of_gauss (Image, ImageLaplaceG, 5)
zero_crossing (ImageLaplaceG, RegionCrossingG)



1.zero_crossing_sub_pix(Image : ZeroCrossings : : )
zero_crossing_sub_pix提取具有亚像素精度的输入图像Image 的零点交叉。
提取的零交叉作为xld 轮廓保存于ZeroCrossings
因此,如果输入图像是经过拉普拉斯滤波的图像,
则可以使用zero_crossing_sub_pix作为亚像素精确边缘提取器(参见 laplace、laplace_of_gauss、derivate_gauss)。


在提取过程中,将输入图像看作是一个表面,其中的灰度值在各个像素中心之间进行双线性插值。
与所定义的表面相一致,每个像素提取零交叉线,并链接到拓扑声音轮廓中。
这意味着零交叉轮廓线在交点处被正确分割。
如果图像包含扩展的灰度值为0的区域,则只将这些区域的边界作为零交叉点返回。


例程:
read_image(Image,'mreut')
derivate_gauss(Image,Laplace,3,'laplace')
zero_crossing_sub_pix(Laplace,ZeroCrossings)
dev_display(ZeroCrossings)

* Detection of edges, i.e, zero crossings of the Laplacian-of-Gaussian
* that have a large gradient magnitude, in an aerial image
read_image(Image,'mreut')
Sigma := 1.5
* Compensate the threshold for the fact that derivate_gauss(...,'gradient')
* calculates a Gaussian-smoothed gradient, in which the edge amplitudes
* are too small because of the Gaussian smoothing, to correspond to a true
* edge amplitude of 20.
Threshold := 20/(Sigma*sqrt(2*3.1415926))
derivate_gauss(Image,Gradient,Sigma,'gradient')
threshold(Gradient,Region,Threshold,255)
reduce_domain(Image,Region,ImageReduced)
derivate_gauss(ImageReduced,Laplace,Sigma,'laplace')
zero_crossing_sub_pix(Laplace,Edges)
dev_display(Edges)
  

halcon从自学到接项目视频教程,另外再赠送全网最全资源  

  

欢迎围观我录制的一套halcon自学视频教程(进入)



回复

使用道具 举报

快速回复 返回列表 客服中心 搜索