用matlab实现多张图片合并

I = imread('qiegray.jpg');
i=imrotate(I,45);
j=imrotate(I,315);
h1 = axes('position', [0.0 0.0 1.0 1.0], 'parent', gcf);
imshow(I, 'parent', h1);

h2 = axes('position', [0.1 0.05 0.3 0.4], 'parent', gcf);
axes(h2);
imshow(j, 'parent', h2);

h3=axes('position', [0.4 0.2 0.6 0.6], 'parent', gcf);
axes(h3);
imshow(i, 'parent', h3);

//qiegrey.jpg是我下载的一个图片,就一个图片的名,根据自己的图片名修改就行了


这个是去除黑边的


dx=300
dy=500;

A = rgb2gray(imread('qie.jpg'));
B = imread('qiegray.jpg');

[r,c] = size(A);
[rb,cb] = size(B);

I1 = imrotate(B,45);
I1 = imresize(I1,0.6);
[r1,c1] = size(I1);

C = zeros(rb,cb)+300;
C = imrotate(C,45);
C = imresize(C,0.6);

figure,imshow(I1)
figure,imshow(C)

for i = 1:1:r1
    for j = 1:1:c1
        %%%%%%%%%%  图像区
        if(C(i,j) >255)
            %%%%%%%%    越界,背景
            if(i+dx<=r && j+dy<=c)
                A(i+dx,j+dy) = I1(i,j);
            end
        end
    end    
end

%figure,imshow(I1);
%figure,imshow(C);
figure,imshow(A);


你可能感兴趣的:(用matlab实现多张图片合并)