频率域滤波基础之二(读数字图像处理学习halcon)

二维离散傅立叶(DFT)变化及其反傅立叶变换(IDFT)


傅立叶变换通用形式


对通用形式来讲,c=1,s=-1即为傅立叶变化(图像空间域转频域);c=1/MN,s=1即为逆变换(频域转空间域)

halcon算子fft_generic(Image : ImageFFT : Direction, Exponent, Norm, Mode, ResultType : ) 通过参数设置可实现图像的频域和空间域的互转。

fft_generic(Image,ImageFFT,'to_freq',-1,'sqrt','dc_center','complex')      等效  fft_image(Image : ImageFFT : : )
fft_generic(Image,ImageFFT,'from_freq',1,'sqrt','dc_center','byte')          等效   fft_image_inv(Image : ImageFFTInv : : )

构建一个理想低通滤波器(ILPF)




read_image (Image, 'D:/halcon work/fft/图.bmp')
rgb1_to_gray (Image, GrayImage)
get_image_size (GrayImage, Width, Height)
gen_image_const (Image1, 'complex', Width, Height)                          	        //生成一幅圈黑的与原图等大的图
gen_circle (Circle, Height/2, Width/2,30)						//确定保留的低通区域
paint_region (Circle, Image1, ImageResult_paint,1.3566e-5, 'fill')			//产生低通滤波器
fft_generic (GrayImage, ImageFFT1, 'to_freq', -1, 'none', 'dc_center', 'complex')
convol_fft (ImageFFT1, ImageResult_paint, ImageConvol1)
fft_generic(ImageConvol1,ImageResult1,'from_freq',1,'none','dc_center','byte')
以上步骤主要突出了建立滤波器过程

halcon中有直接构建低通滤波器的算子gen_lowpass( : ImageLowpass : Frequency, Norm, Mode, Width, Height : )

read_image (Image, 'D:/halcon work/fft/有票.bmp')
rgb1_to_gray (Image, GrayImage)
get_image_size (GrayImage, Width, Height)
gen_lowpass(Lowpass,0.2,'n','dc_center',Width,Height)
fft_generic(GrayImage,ImageFFT2,'to_freq',-1,'none','dc_center','complex')
convol_fft(ImageFFT2,Lowpass,ImageConvol2)
fft_generic(ImageConvol2,ImageResult2,'from_freq',1,'none','dc_center','byte')

布特沃斯低通滤波器



高斯低通滤波器





rgb1_to_gray (Image, GrayImage)
get_image_size (GrayImage, Width, Height)
gen_gauss_filter (ImageGauss, 0.1, 0.1, 0, 'n', 'dc_center',Width, Height)
fft_generic(GrayImage,ImageFFT2,'to_freq',-1,'none','dc_center','complex')
convol_fft(ImageFFT2,ImageGauss,ImageConvol2)
fft_generic(ImageConvol2,ImageResult2,'from_freq',1,'none','dc_center','byte')

  • 5
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值