低频对应于图像变化缓慢的灰度分量,前面我们通过衰减高频成分来平滑图像。高频则对应于图像中变化快速的灰度变化。这些通常是物体的边缘及噪声。以下我们将通过高通滤波来实现图像的锐化。高通滤波会衰减傅立叶变换中的低频分量而不扰乱高频信息。
理想高通滤波器
halcon程序
read_image (Image, 'D:/halcon work/fft/有票.bmp') rgb1_to_gray (Image, GrayImage) get_image_size (GrayImage, Width, Height) gen_highpass (ImageHighpass, 0.1, 'n', 'dc_center', Width, Height) fft_generic(GrayImage,ImageFFT2,'to_freq',-1,'none','dc_center','complex') convol_fft(ImageFFT2,ImageHighpass,ImageConvol2) fft_generic(ImageConvol2,ImageResult2,'from_freq',1,'none','dc_center','byte')
布特沃斯高通滤波器
高斯高通滤波器
read_image (Image, 'D:/halcon work/fft/有票.bmp') rgb1_to_gray (Image, GrayImage) get_image_size (GrayImage, Width, Height) gen_gauss_filter (ImageGauss, 0.1, 0.1, 0, 'none', 'dc_center', Width, Height) gen_image_const (Image1, 'real', Width, Height) paint_region (Image1, Image1, ImageResult, 1, 'fill') sub_image (ImageResult, ImageGauss, ImageSub, 1, 0) fft_generic(GrayImage,ImageFFT2,'to_freq',-1,'none','dc_center','complex') convol_fft(ImageFFT2,ImageSub,ImageConvol2) fft_generic(ImageConvol2,ImageResult2,'from_freq',1,'sqrt','dc_center','byte')
本文出自勇哥的网站《少有人走的路》wwww.skcircle.com,转载请注明出处!讨论可扫码加群:


