Stitching image in 2 direction

2 views (last 30 days)
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.

Accepted Answer

Image Analyst
Image Analyst on 2 Jun 2020
Edited: Image Analyst on 2 Jun 2020
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 Comment
Hieu Tran Doan Trung
Hieu Tran Doan Trung on 2 Jun 2020
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.

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 1 Jun 2020
Edited: Image Analyst on 1 Jun 2020
To stitch images:
wideImage = [image1, image2]; % Must have same number of rows.
tallImage = [image1; image2]; % Must have same number of columns.
  2 Comments
Hieu Tran Doan Trung
Hieu Tran Doan Trung on 2 Jun 2020
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 on 2 Jun 2020
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])

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!