MATLAB滤波代码

clear all;clc;
%FFT变换
I=imread('cameraman.tif');
A1=fft2(I);
A2=ifft2(A1);
A3=uint8(A2);
figure,subplot(221),imshow(I);
subplot(222);imshow(A3);

%DCT变换
I=imread('cameraman.tif');
figure,subplot(223);imshow(I);
I=im2double(I);
T=dctmtx(8);
B=blkproc(I,[8 8], 'P1*x*P2',T,T');
Mask=[1 1 1 1 0 0 0 0
       1 1 1 0 0 0 0 0
       1 1 0 0 0 0 0 0
       1 0 0 0 0 0 0 0
       0 0 0 0 0 0 0 0
       0 0 0 0 0 0 0 0
       0 0 0 0 0 0 0 0
       0 0 0 0 0 0 0 0];
B2=blkproc(B,[8 8],'P1.*x',Mask);    % 此处为点乘(.*)
I2=blkproc(B2,[8 8], 'P1*x*P2',T',T);
subplot(224);imshow(I2);

%直方图均衡
I=imread('pout.tif');
figure,subplot(321);imshow(I);
subplot(322);imhist(I);    
[J,T]=histeq(I,64);      % 图像灰度扩展到0~255,但是只有64个灰度级
subplot(323);

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值