Stitching image in 2 direction

3 次查看(过去 30 天)
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
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
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
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])

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Geographic Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by