Halcon快速入门笔记2
苏州大视通机器视觉
2022年10月04日 02:19
收录于文集
共82篇

原图

read_image (Image, 'I:/Halcon练习/练习2/练习2.png&#​39;)

get_image_size (Image, Width, Height)

*在频域中生成高斯滤波器

gen_gauss_filter (ImageGauss, 100, 100, 0, 'n&#​39;, 'rft&#​39;, Width, Height)

*对图像进行傅里叶变换

rft_generic (Image, ImageFFT, 'to_freq&#​39;, 'none&#​39;, 'complex&#​39;, Width)

*对傅里叶图像做卷积,使用之前创建的高斯滤波器作为卷积核

convol_fft (ImageFFT, ImageGauss, ImageConvol)

*将卷积后的傅里叶图像还原为空间域图像。可见图像的突变部分得到了增强

rft_generic (ImageConvol, ImageFFT1, 'from_freq&#​39;, 'none&#​39;, 'byte&#​39;, Width)

sub_image (Image, ImageFFT1, ImageSub, 5, 100)

*对图像进行缩放,一般图像特别大的时候,缩放一下,提取效果会更好

zoom_image_factor (ImageSub, ImageZoomed, 0.4, 0.4, 'constant&#​39;)

*将图像中的有灰度差异的线条提取出来

lines_gauss (ImageZoomed, Lines1, 0.2, 3, 8, 'light&#​39;, 'true&#​39;, 'gaussian&#​39;, 'true&#​39;)

效果图