求高手!!!!求Matlab图像处理编程。用一下5个程序,合成一个图像处理程序。不用全用。
程序1clearA=imread('meili.BMP')subplot(121)%1行2列第一个位置imshow(A)A=double(A)/255;[M,N]=siz...
程序1
clear
A=imread('meili.BMP')
subplot(121)%1行2列第一个位置
imshow(A)
A=double(A)/255;
[M,N]=size(A)
B(M,N)=0;
for i=1:M
for j=1:N
B(i,j)=1-A(i,j);
end
end
subplot(122)
imshow(B);
程序2
clear
A=imread('meili.BMP')
subplot(221)%1行2列第一个位置
imshow(A)
A=double(A)/255;
[M,N]=size(A)
C=imread('suolong.BMP')
subplot(222)%1行2列第一个位置
imshow(C)
C=double(C)/255;
[M,N]=size(A)
B(M,N)=0;
for i=1:M
for j=1:N
B(i,j)=C(i,j)+A(i,j);
end
end
subplot(223)
imshow(B);
程序3
M=600,N=600,K=3;
X(M,N,K)=0;
X(:,:,1)=1;
X(:,:,2)=1;
X(:,:,3)=1;
X1(M,N,K)=0;
X1(:,:,1)=0.2;
X1(:,:,2)=0.5;
X1(:,:,3)=0.6;
subplot(121)
imshow(X);
subplot(122)
imshow(X1);
Frames=5;
Y(M,N,K,Frames)=0;
x0=300;y0=300;
L=40;Sigama=200;V=10;
Sigama2=Sigama*Sigama*2;
for t=1:Frames
for i=1:M
for j=1:N
rr=(i-x0)*(i-x0)+(j-y0)*(j-y0);
r=sqrt(rr);
alpha=exp(-rr/Sigama2)*((cos(2*pi*(r-V*(t-1))/L)+1)/2);
for k=1:K
Y(i,j,k,t)=alpha*X(i,j,k)+(1-alpha)*X1(i,j,k);
end
end
end
end
clc
for t=1:Frames
pause(0.1)
imshow(Y(:,:,:,t))
end
程序4
clear
A=imread('shi.BMP')
subplot(221)%2行2列第一个位置
imshow(A)
A=double(A)/255;
[M,N,K]=size(A)
C=imread('shamo.BMP')
subplot(222)%2行2列第二个位置
imshow(C)
C=double(C)/255;
B(M,N,K)=0;
for i=1:M
for j=1:N
for k=1:3
B(i,j,k)=C(i,j,k)+A(i,j,k);
end
end
end
subplot(223)%2行2列第三个位置
imshow(B);
程序5
clear
filename=('shi.bmp');
A=imread(filename);
imshow(A)
%imageinformation=imfinfo(filename);
%M=imageinformation Height;
%N=imageinformation Width;
%
[M,N,K]=size(A)
A=double(A)/255;
for i=1:M
for j=1:N
for k=1:3
B(i,j,k)=1-A(i,j,k);
end
end
end
figure
imshow(B)
程序一二不要,将程序三和 四或五结合成一个就行。 展开
clear
A=imread('meili.BMP')
subplot(121)%1行2列第一个位置
imshow(A)
A=double(A)/255;
[M,N]=size(A)
B(M,N)=0;
for i=1:M
for j=1:N
B(i,j)=1-A(i,j);
end
end
subplot(122)
imshow(B);
程序2
clear
A=imread('meili.BMP')
subplot(221)%1行2列第一个位置
imshow(A)
A=double(A)/255;
[M,N]=size(A)
C=imread('suolong.BMP')
subplot(222)%1行2列第一个位置
imshow(C)
C=double(C)/255;
[M,N]=size(A)
B(M,N)=0;
for i=1:M
for j=1:N
B(i,j)=C(i,j)+A(i,j);
end
end
subplot(223)
imshow(B);
程序3
M=600,N=600,K=3;
X(M,N,K)=0;
X(:,:,1)=1;
X(:,:,2)=1;
X(:,:,3)=1;
X1(M,N,K)=0;
X1(:,:,1)=0.2;
X1(:,:,2)=0.5;
X1(:,:,3)=0.6;
subplot(121)
imshow(X);
subplot(122)
imshow(X1);
Frames=5;
Y(M,N,K,Frames)=0;
x0=300;y0=300;
L=40;Sigama=200;V=10;
Sigama2=Sigama*Sigama*2;
for t=1:Frames
for i=1:M
for j=1:N
rr=(i-x0)*(i-x0)+(j-y0)*(j-y0);
r=sqrt(rr);
alpha=exp(-rr/Sigama2)*((cos(2*pi*(r-V*(t-1))/L)+1)/2);
for k=1:K
Y(i,j,k,t)=alpha*X(i,j,k)+(1-alpha)*X1(i,j,k);
end
end
end
end
clc
for t=1:Frames
pause(0.1)
imshow(Y(:,:,:,t))
end
程序4
clear
A=imread('shi.BMP')
subplot(221)%2行2列第一个位置
imshow(A)
A=double(A)/255;
[M,N,K]=size(A)
C=imread('shamo.BMP')
subplot(222)%2行2列第二个位置
imshow(C)
C=double(C)/255;
B(M,N,K)=0;
for i=1:M
for j=1:N
for k=1:3
B(i,j,k)=C(i,j,k)+A(i,j,k);
end
end
end
subplot(223)%2行2列第三个位置
imshow(B);
程序5
clear
filename=('shi.bmp');
A=imread(filename);
imshow(A)
%imageinformation=imfinfo(filename);
%M=imageinformation Height;
%N=imageinformation Width;
%
[M,N,K]=size(A)
A=double(A)/255;
for i=1:M
for j=1:N
for k=1:3
B(i,j,k)=1-A(i,j,k);
end
end
end
figure
imshow(B)
程序一二不要,将程序三和 四或五结合成一个就行。 展开
2个回答
展开全部
clear
A=imread('meili.BMP')
subplot(331)%1行1列第一个位置
imshow(A)
A=double(A)/255;
[M,N]=size(A)
C=imread('suolong.BMP')
subplot(332)
imshow(C)
C=double(C)/255;
[M,N]=size(A)
B(M,N)=0;
for i=1:M
for j=1:N
B(i,j)=C(i,j)+A(i,j);
end
end
subplot(333)
imshow(B);
M=600,N=600,K=3;
X(M,N,K)=0;
X(:,:,1)=1;
X(:,:,2)=1;
X(:,:,3)=1;
X1(M,N,K)=0;
X1(:,:,1)=0.2;
X1(:,:,2)=0.5;
X1(:,:,3)=0.6;
subplot(121)
imshow(X);
subplot(122)
imshow(X1);
Frames=5;
Y(M,N,K,Frames)=0;
x0=300;y0=300;
L=40;Sigama=200;V=10;
Sigama2=Sigama*Sigama*2;
for t=1:Frames
for i=1:M
for j=1:N
rr=(i-x0)*(i-x0)+(j-y0)*(j-y0);
r=sqrt(rr);
alpha=exp(-rr/Sigama2)*((cos(2*pi*(r-V*(t-1))/L)+1)/2);
for k=1:K
Y(i,j,k,t)=alpha*X(i,j,k)+(1-alpha)*X1(i,j,k);
end
end
end
end
clc
for t=1:Frames
pause(0.1)
imshow(Y(:,:,:,t))
end
A=imread('shi.BMP')
subplot(334)
imshow(A)
A=double(A)/255;
[M,N,K]=size(A)
C=imread('shamo.BMP')
subplot(335)
imshow(C)
C=double(C)/255;
B(M,N,K)=0;
for i=1:M
for j=1:N
for k=1:3
B(i,j,k)=C(i,j,k)+A(i,j,k);
end
end
end
subplot(336)
imshow(B);
for i=1:M
for j=1:N
for k=1:3
B(i,j,k)=1-A(i,j,k);
end
end
end
figure
imshow(B)
subplot(337)
A=imread('meili.BMP')
subplot(331)%1行1列第一个位置
imshow(A)
A=double(A)/255;
[M,N]=size(A)
C=imread('suolong.BMP')
subplot(332)
imshow(C)
C=double(C)/255;
[M,N]=size(A)
B(M,N)=0;
for i=1:M
for j=1:N
B(i,j)=C(i,j)+A(i,j);
end
end
subplot(333)
imshow(B);
M=600,N=600,K=3;
X(M,N,K)=0;
X(:,:,1)=1;
X(:,:,2)=1;
X(:,:,3)=1;
X1(M,N,K)=0;
X1(:,:,1)=0.2;
X1(:,:,2)=0.5;
X1(:,:,3)=0.6;
subplot(121)
imshow(X);
subplot(122)
imshow(X1);
Frames=5;
Y(M,N,K,Frames)=0;
x0=300;y0=300;
L=40;Sigama=200;V=10;
Sigama2=Sigama*Sigama*2;
for t=1:Frames
for i=1:M
for j=1:N
rr=(i-x0)*(i-x0)+(j-y0)*(j-y0);
r=sqrt(rr);
alpha=exp(-rr/Sigama2)*((cos(2*pi*(r-V*(t-1))/L)+1)/2);
for k=1:K
Y(i,j,k,t)=alpha*X(i,j,k)+(1-alpha)*X1(i,j,k);
end
end
end
end
clc
for t=1:Frames
pause(0.1)
imshow(Y(:,:,:,t))
end
A=imread('shi.BMP')
subplot(334)
imshow(A)
A=double(A)/255;
[M,N,K]=size(A)
C=imread('shamo.BMP')
subplot(335)
imshow(C)
C=double(C)/255;
B(M,N,K)=0;
for i=1:M
for j=1:N
for k=1:3
B(i,j,k)=C(i,j,k)+A(i,j,k);
end
end
end
subplot(336)
imshow(B);
for i=1:M
for j=1:N
for k=1:3
B(i,j,k)=1-A(i,j,k);
end
end
end
figure
imshow(B)
subplot(337)
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询