内容发布更新时间 : 2024/12/23 23:39:35星期一 下面是文章的全部内容请认真阅读。
%灰色图像拼接 clc; clear;
A=imread('C:\\Documents and Settings\\s35\\桌面\\新建文件夹\\v1.jpg'); figure,imshow(A) A1=im2bw(A); A2=double(A1); se=strel('disk',20); A4=imdilate(A2,se); figure,imshow(A4) A5=double(A4); A6=not(A5); A7=double(A6);
B=imread('C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\示例图片\\Water lilies.jpg');
C=imread('C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\示例图片\\Winter.jpg'); [m,n]=size(A4); B2=rgb2gray(B);
B3=imresize(B2,[m,n]); B4=double(B3); C2=rgb2gray(C);
C3=imresize(C2,[m,n]); C4=double(C3);
D=A5.*B4; E=A7.*C4; F=uint8(D+E); figure,imshow(F)
%彩色图像拼接 clc; clear;
A=imread('C:\\Documents and Settings\\s35\\桌面\\新建文件夹\\v1.jpg'); figure,imshow(A) A1=im2bw(A); A2=double(A1); se=strel('disk',20); A4=imdilate(A2,se); figure,imshow(A4)
A5=double(A4); A6=not(A5); A7=double(A6); [m,n]=size(A5);
B=imread('C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\示例图片\\Water lilies.jpg');
C=imread('C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\示例图片\\Winter.jpg'); %提取红色分量 red1=B(:,:,1); red2=C(:,:,1);
B31=imresize(red1,[m,n]); B41=double(B31);
C31=imresize(red2,[m,n]); C41=double(C31);
D1=A5.*B41; E1=A7.*C41; F(:,:,1)=D1+E1;
%提取绿色分量 green1=B(:,:,2); green2=C(:,:,2);
B32=imresize(green1,[m,n]); B42=double(B32);
C32=imresize(green2,[m,n]); C42=double(C32);
D2=A5.*B42; E2=A7.*C42; F(:,:,2)=D2+E2;
%提取蓝色分量 blue1=B(:,:,3); blue2=C(:,:,3);
B33=imresize(blue1,[m,n]); B43=double(B33);
C33=imresize(blue2,[m,n]); C43=double(C33);
D3=A5.*B43; E3=A7.*C43; F(:,:,3)=D3+E3;
F=uint8(F);
figure,imshow(F)