用matlab實現多張圖片合併
阿新 • • 發佈:2019-01-04
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);