数字图像处理题库.docx

上传人:b****4 文档编号:3138064 上传时间:2022-11-17 格式:DOCX 页数:14 大小:18.58KB
下载 相关 举报
数字图像处理题库.docx_第1页
第1页 / 共14页
数字图像处理题库.docx_第2页
第2页 / 共14页
数字图像处理题库.docx_第3页
第3页 / 共14页
数字图像处理题库.docx_第4页
第4页 / 共14页
数字图像处理题库.docx_第5页
第5页 / 共14页
点击查看更多>>
下载资源
资源描述

数字图像处理题库.docx

《数字图像处理题库.docx》由会员分享,可在线阅读,更多相关《数字图像处理题库.docx(14页珍藏版)》请在冰豆网上搜索。

数字图像处理题库.docx

数字图像处理题库

1.选择一副图像eight.tif,设置输入/输出变换的灰度级范围,a=0.3,b=5,c=3,d=6。

I=imread('eight.tif');

I=im2double(I);

I1=0.3.*I+5/255;

I2=3.*I+6/255;

subplot(1,3,1);imshow(I);title('原始图像');

subplot(1,3,2);imshow(I1);title('a=0.3,b=5');

subplot(1,3,3);imshow(I2);title('a=3,b=6');

2.设置非线性扩展函数的参数c=2,r=1.5,对图像eight.tif进行变换。

I=imread('eight.tif');

c=2;

r=1.5;

S=imadjust(I,[],[],r)*c;

subplot(1,2,1);imshow(I);title('原始图像');

subplot(1,2,2);imshow(S);title('非线性扩展的图像');

3.采用灰度倒置变换函数s=255-r进行图像eight.tif变换

I=imread('eight.tif');

I=im2double(I);

a=-1;

b=255;

S=a.*I+b/255;

subplot(1,2,1);imshow(I);title('原始图像');

subplot(1,2,2);imshow(S);title('变换后的图像');

4.对图像eight.tif进行旋转45度和180度

I=imread('eight.tif');

J=imrotate(I,60,'bilinear');

K=imrotate(I,180,'bilinear');

subplot(1,3,1);imshow(I);title('原始图像');

subplot(1,3,2);imshow(J);title('旋转60图像');

subplot(1,3,3);imshow(K);title('旋转180图像');

5.选取一副图像eight.tif,进行离散傅里叶变换,将其中心移到零点,得到其离散傅里叶变换。

参考例4.10

I=imread('eight.tif');

I1=fftshift(fft2(I));

subplot(1,2,1);imshow(I);title('原始图像');

subplot(1,2,2);imshow(log(abs(I1)),[]);title('变换后的图像');

6.选取一副图像,进行离散傅里叶变换,再对其进行一定角度的旋转,进行离散傅里叶变换.参考例4.6

I=zeros(255,255);

I(100:

150,50:

200)=1;

I1=fftshift(abs(fft2(I)));

I2=imrotate(I,60,'bilinear','crop');

I3=fftshift(abs(fft2(I2)));

subplot(1,4,1);imshow(I);title('原始图像');

subplot(1,4,2);imshow(I1,[550]);title('傅立叶变换后的图像');

subplot(1,4,3);imshow(I2);title('旋转90度后图像');

subplot(1,4,4);imshow(I3,[550]);title('傅立叶变换后的原始图像');

7.选取一副图像eight.tif,进行离散余弦变换,并对其进行离散余弦反变换。

参考例4.13

I=imread('eight.tif');

I1=dct2(I);

I2=idct2(I1)/255;

subplot(1,3,1);imshow(I);title('原始图像');

subplot(1,3,2);imshow(I1);title('余弦变换图像');

subplot(1,3,3);imshow(I2);title('反余弦变换图像');

8.选取一副图像eight.tif,采用butterworth高通滤波器对图像进行高通滤波。

参考例5.7

I=imread('eight.tif');

I1=fftshift(fft2(I));

[M,N]=size(I1);

n=2;d0=30;

n1=floor(M/2);

n2=floor(N/2);

forx=1:

M

fory=1:

N

d=sqrt((x-n1)^2+(y-n2)^2);

H=1/(1+(d0/d)^(2*n));

I2(x,y)=H*I1(x,y);

end

end

I2=ifftshift(I2);

I3=real(ifft2(I2));

subplot(1,2,1);imshow(I);title('原始图像');

subplot(1,2,2);imshow(I3);title('Butterworth高通滤波处理后的图像');

9.选择一副图像eight.tif,对灰度图像进行直方图均衡化处理。

I=imread('eight.tif');

K=16;

H=histeq(I,K);

figure,

subplot(2,2,1);imshow(I,[]);title('原始图像');

subplot(2,2,2);imshow(H,[]),holdon

subplot(2,2,3),hist(double(I),16);

subplot(2,2,4),hist(double(H),16);

10.选择一副图像eight.tif,对灰度图像采用均值滤波。

img=imread('eight.tif');

subplot(1,3,1);imshow(img);title('原图');

img_noise=double(imnoise(img,'salt&pepper',0.08));

subplot(1,3,2);imshow(img_noise,[]);title('加噪点图');

img_deal=imfilter(img_noise,fspecial('average',5));

subplot(1,3,3);imshow(img_deal,[]);title('平滑图');

11.选择一副图像coins.png,对灰度图像,采用prewitt边缘算子和sobel算子对图像进行增强处理。

img=imread('coins.png');

img1=edge(img,'prewitt');

img2=edge(img,'sobel');

subplot(1,3,1);imshow(img);title('原始图像');

subplot(1,3,2);imshow(img1);title('prewitt');

subplot(1,3,3);imshow(img2);title('sobel');

12.仿照matlab识别圆形物体例程,对coins.png图像进行处理。

I=imread('coins.png');

threshold=graythresh(I);

bw=im2bw(I,threshold);

imshow(I);

%removeallobjectcontainingfewerthan30pixels

bw=bwareaopen(bw,30);

%fillagapinthepen'scap

se=strel('disk',2);

bw=imclose(bw,se);

%fillanyholes,sothatregionpropscanbeusedtoestimate

%theareaenclosedbyeachoftheboundaries

bw=imfill(bw,'holes');

[B,L]=bwboundaries(bw,'noholes');

%Displaythelabelmatrixanddraweachboundary

holdon

fork=1:

length(B)

boundary=B{k};

plot(boundary(:

2),boundary(:

1),'w','LineWidth',2)

end

imshow(I);

stats=regionprops(L,'Area','Centroid');

threshold=0.94;

%loopovertheboundaries

fork=1:

length(B)

%obtain(X,Y)boundarycoordinatescorrespondingtolabel'k'

boundary=B{k};

%求周长

delta_sq=diff(boundary).^2;

perimeter=sum(sqrt(sum(delta_sq,2)));

%求面积

area=stats(k).Area;

%求半径

metric=2*area/perimeter;

metric_string=sprintf('r=%2.2f',metric);

text(boundary(1,2)-35,boundary(1,1)+13,metric_string,'Color','y',...

'FontSize',14,'FontWeight','bold');

end

title('求各个硬币的半径');

13.对灰度图像进行直线检测,参考例8.2

I=imread('img1.bmp');

I=rgb2gray(I);

bw=edge(I,'log');

[H,T,R]=hough(bw);

P=houghpeaks(H,5,'threshold',ceil(0.3*max(H(:

))));

x=T(P(:

2));

y=R(P(:

1));

lines=houghlines(bw,T,R,P,'FillGap',5,'MinLength',10);

imshow(bw);

holdon;

max_len=0;

fork=1:

length(lines)

xy=[lines(k).point1;lines(k).point2];

plot(xy(:

1),xy(:

2),'LineWidth',2,'Color','g');

end

14.对图像eight.tif进行OSTU算法阈值分割,参考例8.4

i=imread('eight.tif');

[width,height]=size(i);

thresh=graythresh(i);

bw=im2bw(i,thresh);

imshow(bw);

15.对图像img3.bmp进行开运算和闭运算以及填充,参考例8.11

i=imread('img3.bmp');

i=rgb2gray(i);

bw=im2bw(i);

se=strel('disk',6);

bw=imopen(bw,se);

bw=~bw;

imshow(bw);

16.识别图像中字的个数。

参考matlab例程CorrectingNonuniformIllumination

i=imread('img4.bmp');

i=rgb2gray(i);

thresh=graythresh(i);

bw=im2bw(i,thresh);

se=strel('disk',2);

bw=~bw;

bw=imdilate(bw,se);

[labeled,nu

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 农林牧渔 > 林学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1