- 1、本文档共11页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
1.将图像二值化
I=imread(nan.jpg);
BW=im2bw(I,0.2);//必须在0-1之间
imshow(BW)
2.灰度图像保存文件名必须为.pgm
3.将灰度图像转换为二值图像
I=imread(nan.pgm);
subplot(121);
imshow(I);
title(?-?ò?èí???)
subplot(122);
BW=dither(I);
imshow(BW);
title(×a??oóμ??t?μí???)
4.滑动邻域操作
I=imread(nan.pgm);//格式必须为.pgm,即二值图像
f=@(x)max(x(:));
I2=nlfilter(I,[3,3],f);
figure,
subplot(121);imshow(I);subplot(122);imshow(I2);
5.分离块操作
I=imread(nan.pgm);
f=@(x)uint8(round(mean2(x)*ones(size(x))));
I2=blkproc(I,[8,8],f);
figure
subplot(121);imshow(I);subplot(122);imshow(I2);
6.图像插值
I=imread(nan.pgm);
[m,n]=size(I);
x=1:n;y=1:m;[x,y]=meshgrid(x,y);
x1=1:4:n;y1=1:4:m;[x1,y1]=meshgrid(x1,y1);
I1=interp2(x,y,I,x1,y1,nearest);
figure,
subplot(121),imshow(I);subplot(122),imshow(I1);
7.图像缩放
I=imread(nan.pgm);
[m,n]=size(I);
J1=imresize(I,0.08);
J2=imresize(I,8,nearest);
J3=imresize(I,[18*m 18*n],bilinear);
figure,
subplot(221),imshow(I);subplot(222),imshow(J1);
subplot(223),imshow(J2);subplot(224),imshow(J3);
8.图像交互式剪裁
I=imread(nan.pgm);
figure,imshow(I)
I0=imcrop;
figure,imshow(I0);
9.图像参数式剪裁
I=imread(nan.pgm);
I2=imcrop(I,[150 160 150 150]);
imshow(I),figure,imshow(I2)
10.离散余弦变换
RGB=imread(nannan.jpg);
I=rgb2gray(RGB);
J=dct2(I);
imshow(log(abs(J)),[])
colormap(jet(64)),colorbar
figure;
J(abs(J)10)=0;
K=idct2(J)/50;
imshow(K)
11.余弦变换压缩
I=imread(nan.pgm);
I=im2double(I);
T=dctmtx(8);
B=blkproc(I,[8 8],P1*x*P2,T,T);
mask=[1 1 1 1 1 0 0 0
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];
B2=blkproc(B,[8 8],P1.*x,mask);
I2=blkproc(B2,[8 8],P1*x*P2,T,T);
imshow(I)
figure;
imshow(I2)
12.小波变换压缩
I=imread(nan.pgm);
subplot(221);
image(I);
colormap(map)
title(?-ê?í???);
axis square
disp(?1???°í???Xμ?′óD?);
whos(I)
[c,s]=wavedec2(I,2,bior3.7);
cal=appcoef2(c,s,bior3.7,1);
ch1=detcoef2(h,c,s,1);
cv1=detcoef2(v,c,s,1);
cd1=detcoef2(d,c,s,1);
a1=wrcoef2(a,c,s,bior3.7,1);
h1=wrcoef2(h,c,s,bior3.7,1);
v1=wrcoef2(v,c,s,bior3.7,1);
d1=w
文档评论(0)