Remove the seams line when stitching image
2 views (last 30 days)
Show older comments
Hello everyone.
I used this code below to stitching 2 image together. However , how to remove the seamsline
Thanks in advance.
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])
0 Comments
Answers (1)
vaibhav mishra
on 30 Jun 2020
for this task, you can use the concept of pyramid blending.
refer to this blog for more information -: https://blogs.mathworks.com/steve/2019/05/20/multiresolution-pyramids-part-4-image-blending/
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!