中南民族大学数字图像处理程序及图像Word文档下载推荐.docx

上传人:b****8 文档编号:22297124 上传时间:2023-02-03 格式:DOCX 页数:34 大小:957.08KB
下载 相关 举报
中南民族大学数字图像处理程序及图像Word文档下载推荐.docx_第1页
第1页 / 共34页
中南民族大学数字图像处理程序及图像Word文档下载推荐.docx_第2页
第2页 / 共34页
中南民族大学数字图像处理程序及图像Word文档下载推荐.docx_第3页
第3页 / 共34页
中南民族大学数字图像处理程序及图像Word文档下载推荐.docx_第4页
第4页 / 共34页
中南民族大学数字图像处理程序及图像Word文档下载推荐.docx_第5页
第5页 / 共34页
点击查看更多>>
下载资源
资源描述

中南民族大学数字图像处理程序及图像Word文档下载推荐.docx

《中南民族大学数字图像处理程序及图像Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《中南民族大学数字图像处理程序及图像Word文档下载推荐.docx(34页珍藏版)》请在冰豆网上搜索。

中南民族大学数字图像处理程序及图像Word文档下载推荐.docx

RGB=imread('

autumn.tif'

figure

(1),imshow(RGB);

I=rgb2gray(RGB);

figure

(2),imshow(I);

J=dct2(I);

figure(3),imshow(log(abs(J)),[]),colormap(jet(64)),colorbar;

J(abs(J)<

10)=0;

K=idct2(J)/255;

figure(4),imshow(K);

1——5——2

cr=0.125;

sig=imread('

cameraman.tif'

sig=double(sig)/255;

figure

(1),imshow(sig);

[m_sig,n_sig]=size(sig);

sizi=8;

snum=64;

t=hadamard(sizi);

hdcoe=blkproc(sig,[sizisizi],'

P1*x*P2'

t,t'

coe=im2col(hdcoe,[sizisizi],'

distinct'

coe_temp=coe;

[YInd]=sort(coe);

[m,n]=size(coe);

snum=snum-snum*cr;

fori=1:

n

coe_temp(Ind(1:

snum),i)=0;

end

re_hdcoe=col2im(coe_temp,[sizisizi],[m_sign_sig],'

re_sig=blkproc(re_hdcoe,[sizisizi],'

re_sig=double(re_sig)/64;

figure

(2);

imshow(re_sig);

error=sig.^2-re_sig.^2;

MSE=sum(error(:

))/prod(size(re_sig));

2——1

i=imread('

pout.tif'

imshow(i);

subplot(1,2,1);

imhist(i);

j=histeq(i,64);

subplot(1,2,2)

imhist(j)

2——2

f=imread('

gl=imadjust(f,[01],[1,0]);

subplot(121);

subplot(122);

imshow(gl);

2——3

gl=imadjust(f,[0.50.75],[1,0]);

2——4

gl=imadjust(f,[],[],2);

test1

I=imread('

[row,col]=size(I);

imshow(I);

K=histeq(I,64)

imhist(K);

title('

直方图均衡化'

J=zeros(row,col);

fori=1:

row

forj=1:

col

if(I(i,j)<

10&

&

I(i,j)>

0)

J(i,j)=0.5*I(i,j);

elseif(I(i,j)<

20)

J(i,j)=2*I(i,j)-15;

30)

J(i,j)=0.5*I(i,j)+15;

else

end

J=uint8(J);

imhist(J)

线形变化'

test2

figure

f=imcomplement(I);

imshow(f)

求反图像'

I1=I;

axis([50,250,50,200]);

gridon;

%显示网格线

axison;

%显示坐标系

J=double(I1);

J=40*(log(J+1));

H=uint8(J);

subplot(1,2,2),imshow(H);

对数变换处理'

3-1

eight.tif'

J=imnoise(I,'

salt&

pepper'

0.02);

原始图像'

subplot(1,2,2);

imshow(J);

噪声图像'

K1=filter2(fspecial('

average'

3),J)/255;

K2=filter2(fspecial('

5),J)/255;

K3=filter2(fspecial('

7),J)/255;

figure,imshow(K1);

3*3模板均值滤波'

figure,imshow(K2);

5*5模板均值滤波'

figure,imshow(K3);

7*7模板均值滤波'

3-2

subplot(2,2,1);

K1=medfilt2(J,[33]);

K2=medfilt2(J,[55]);

K3=medfilt2(J,[77]);

subplot(2,2,2);

imshow(K1);

3*3模板中值滤波'

subplot(2,2,3);

imshow(K2);

5*5模板中值滤波'

subplot(2,2,4);

imshow(K3);

7*7模板中值滤波'

3-3

moon.tif'

w4=fspecial('

laplacian'

0);

w8=[111;

1-81;

111];

f=im2double(f);

g4=imfilter(f,w4,'

replicate'

g8=imfilter(f,w8,'

G4=f-g4;

G8=f-g8;

figure,imshow(G4);

figure,imshow(G8);

3-4

I1=imread('

imshow(I1);

I2=imnoise(I1,'

imshow(I2);

)'

;

f=double(I2);

g=fft2(f);

g=fftshift(g);

[N1,N2]=size(g);

n=2;

do=50;

n1=fix(N1/2);

n2=fix(N2/2);

N1

forj=2:

N2

d=sqrt((i-n1)^2+(j-n2)^2);

h=1/(1+0.414*(d/do)^(2*n));

result1(i,j)=h*g(i,j);

if(g(i,j)>

50)

result2(i,j)=0;

result2(i,j)=g(i,j);

result1=ifftshift(result1);

result2=ifftshift(result2);

X2=ifft2(result1);

X3=uint8(real(X2));

subplot(2,2,3);

imshow(X3);

title('

Butterworth滤波图像'

X4=ifft2(result2);

X5=uint8(real(X4));

subplot(2,2,4);

imshow(X5);

理想低通滤波器'

test1

m83.tif'

board.tif'

sobel'

w8=[121;

000;

-1-2-1];

4-1

d=15

h=zeros(2*d+1,2*d+1);

h(d+1,1:

2*d+1)=1/(2*d);

[m,n]=size(f);

fe=zeros(m+2*d,n+2*d);

fe(1:

m,1:

n)=f;

he=zeros(m+2*d,n+2*d);

he(1:

2*d+1,1:

2*d+1)=h;

F=fft2(fe);

H=fft2(he);

ns=5*rand(m+2*d,n+2*d);

g=ifft2(F.*H)+ns;

G=fft2(g);

K=0;

F_est=((H.^2)./(H.^2+K)).*G./H;

f_est=real(ifft2(F_est));

imshow(g(d+1:

m+d,d+1:

n+d),[min(g(:

))max(g(:

))]);

imshow(f_est(1:

n),[min(f_est(:

))max(f_est(:

4-2

F=checkerboard(8);

figure

(1);

imshow(F,[]);

PSF=fspecial('

motion'

7,45);

MF=imfilter(F,PSF,'

circular'

noise=imnoise(zeros(size(F)),'

gaussian'

0,0.01);

MFN=MF+noise;

imshow(MFN,[]);

NSR=sum(noise(:

).^2)/sum(MFN(:

).^2);

figure(3);

imshow(deconvwnr(MFN,PSF),[]);

figure(4);

imshow(deconvwnr(MFN,PSF,NSR),[]);

Sn=abs(fft2(noise)).^2;

Sf=abs(fft2(F)).^2;

NCORR=fftshift(real(ifft2(Sn)));

ICORR=fftshift(real(ifft2(Sf)));

figure(5);

imshow(deconvwnr(MFN,PSF,NCORR,ICORR),[]);

5-1

I=imread('

circuit.tif'

BW1=edge(I,'

prewitt'

BW2=edge(I,'

canny'

BW3=edge(I,'

BW4=edge(I,'

roberts'

BW5=edge(I,'

log'

BW6=edge(I,'

zerocross'

subplot(131)

imshow(BW1);

subplot(132)

imshow(BW2);

subplot(133)

imshow(BW3);

imshow(BW4);

imshow(BW5);

imshow(BW6);

5-2

clearall

cameraman.bmp'

subplot(1,2,1),imshow(I);

level=graythresh(I);

%确定灰度阈值

BW=im2bw(I,level);

subplot(1,2,2),imshow(BW);

Otsu法阈值分割图像'

xian.bmp'

%载入图像

I1=rgb2gray(I);

灰度图像'

se=strel('

disk'

1);

%生成圆形结构元素

I2=imdilate(I1,se);

%用生成的结构元素对图像进行膨胀

膨胀后图像'

%=rgb2gray(I);

灰度图像'

[m,n]=size(I1);

%测量图像尺寸参数

GP=zeros(1,256);

%预创建存放灰度出现概率的向量

fork=0:

255

GP(k+1)=length(find(I1==k))/(m*n);

%计算每级灰度出现的概率,将其存入GP中相应位置

subplot(2,2,2),bar(0:

255,GP,'

g'

)%绘制直方图

灰度直方图'

xlabel('

灰度值'

ylabel('

出现概率'

I2=im2bw(I,150/255);

subplot(2,2,3),imshow(I2);

阈值150的分割图像'

I3=im2bw(I,200/255);

%

subplot(2,2,4),imshow(I3);

阈值200的分割图像'

%I=rgb2gray(I);

%如果是rgb图像就加,如果不是就不要这行

figure,imshow(I),title('

I=double(I);

[M,N]=size(I);

[y,x]=getpts;

%获得区域生长起始点

x1=round(x);

%横坐标取整

y1=round(y);

%纵坐标取整

seed=I(x1,y1);

%将生长起始点灰度值存入seed中

Y=zeros(M,N);

%作一个全零与原图像等大的图像矩阵Y,作为输出图像矩阵

Y(x1,y1)=1;

%将Y中与所取点相对应位置的点设置为白场

sum=seed;

%储存符合区域生长条件的点的灰度值的和

suit=1;

%储存符合区域生长条件的点的个数

count=1;

%记录每次判断一点周围八点符合条件的新点的数目

threshold=15;

%域值

whilecount>

s=0;

%记录判断一点周围八点时,符合条件的新点的灰度值之和

count=0;

M

forj=1:

N

ifY(i,j)==1

if(i-1)>

0&

(i+1)<

(M+1)&

(j-1)>

(j+1)<

(N+1)%判断此点是否为图像边界上的点

foru=-1:

1%判断点周围八点是否符合域值条件

forv=-1:

1%u,v为偏移量

ifY(i+u,j+v)==0&

abs(I(i+u,j+v)-seed)<

=threshold&

1/(1+1/15*abs(I(i+u,j+v)-seed))>

0.8%判断是否未存在于输出矩阵Y,并且为符合域值条件的点

Y(i+u,j+v)=1;

%符合以上两条件即将其在Y中与之位置对应的点设置为白场

count=count+1;

s=s+I(i+u,j+v);

%此点的灰度之加入s中

end

suit=suit+count;

%将n加入符合点数计数器中

sum=sum+s;

%将s加入符合点的灰度值总合中

seed=sum/suit;

%计算新的灰度平均值

figure,imshow(Y),title('

分割后图像'

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

当前位置:首页 > 职业教育 > 职高对口

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

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