Stitching image in 2 direction

조회 수: 2 (최근 30일)
Hieu Tran Doan Trung
Hieu Tran Doan Trung 2020년 6월 1일
댓글: Hieu Tran Doan Trung 2020년 6월 2일
Hello everyone.
Anyone know how to sitching 2 images in 2 direction.
2 pictures below can not stitching in 1 direction (the postion of the nose and eyes are not in the same column and rows)
Thanks in advance.

채택된 답변

Image Analyst
Image Analyst 2020년 6월 2일
편집: Image Analyst 2020년 6월 2일
If you don't want to butt the images against each other but there is some overlap that needs to be determined, then you will need to look up "panorama" : https://www.mathworks.com/matlabcentral/answers/?term=tag%3A%22panorama%22
  댓글 수: 1
Hieu Tran Doan Trung
Hieu Tran Doan Trung 2020년 6월 2일
Many usefull information, thanks so much for sharing this. I tried some of them.
At the moment i haven't solve the problem and i will stick with it in long period of time.
Anyway, i posted another question about the seams and stitching line in stitching image you may see it in the stitching pictures. Could you accept the questions please.
Many thanks to you. Good luck and have a nice day.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2020년 6월 1일
편집: Image Analyst 2020년 6월 1일
To stitch images:
wideImage = [image1, image2]; % Must have same number of rows.
tallImage = [image1; image2]; % Must have same number of columns.
  댓글 수: 2
Hieu Tran Doan Trung
Hieu Tran Doan Trung 2020년 6월 2일
Hello, thanks for quickly reply me.
Anyway, it is not simple like those solution above which can easily solve by montage or someothers thing.
2 pictures stitching together look like the pictures under. However, the pictures below is 1 direction stitching, not 2 direction stitching. I hope someone may give me a suggestion to solve this.
Thank you so much.
Hieu Tran Doan Trung
Hieu Tran Doan Trung 2020년 6월 2일
This is the code file for 1 direction stitching
clc;
clear all;
close all;
I1 = imread('Lena_p4.png');
I2 = imread('Lena_p5.png');
F = im2double(I1);
S = im2double(I2);
[rows cols] = size(F(:,:,1));
Tmp = [];
temp = 0;
for j = 1:cols% to prevent j to go beyond boundaries.
for i = 1:rows
temp = temp + (F(i,j,1) - S(i,1,1))^2;
end
Tmp = [Tmp temp]; % Tmp keeps growing, forming a matrix of 1*cols
temp = 0;
end
%
[Min_value, Index] = min(Tmp);
n_cols = Index + cols - 1;% New column of output image.
Opimg = [];
for i = 1:rows
for j = 1:Index
for y = 1:3
Opimg(i,j,y) = F(i,j,y);% First image is pasted till Index.
end
end
for k = Index+1:n_cols-1
for y = 1:3
Opimg(i,k,y) = S(i,k-Index+1,y);%Second image is pasted after Index.
end
end
end
[r_Opimg c_Opimg] = size(Opimg(:,:,1));
subplot(1,3,1);
imshow(F);axis ([1 c_Opimg 1 c_Opimg])
title('First Image');
subplot(1,3,2);
imshow(S);axis ([1 c_Opimg 1 c_Opimg])
title('Second Image');
subplot(1,3,3);
imshow(Opimg);axis ([1 c_Opimg 1 c_Opimg])

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by