For those looking for the complete code, it's available here:
Image Mosaicing in MAtlab using SIFT and RANSAC
조회 수: 4 (최근 30일)
이전 댓글 표시
The following is a piece of code that forms a Mosaic of two images after computing the Homography Matrix H using RANSAC pror to which SIFT was used to compute the descriptors:
% --------------------------------------------------------------------
% Mosaic
% --------------------------------------------------------------------
box2 = [1 size(im2,2) size(im2,2) 1 ;
1 1 size(im2,1) size(im2,1) ;
1 1 1 1 ] ;
box2_ = inv(H) * box2 ;
box2_(1,:) = box2_(1,:) ./ box2_(3,:) ;
box2_(2,:) = box2_(2,:) ./ box2_(3,:) ;
ur = min([1 box2_(1,:)]):max([size(im1,2) box2_(1,:)]) ;
vr = min([1 box2_(2,:)]):max([size(im1,1) box2_(2,:)]) ;
[u,v] = meshgrid(ur,vr) ;
im1_ = vl_imwbackward(im2double(im1),u,v) ;
z_ = H(3,1) * u + H(3,2) * v + H(3,3) ;
u_ = (H(1,1) * u + H(1,2) * v + H(1,3)) ./ z_ ;
v_ = (H(2,1) * u + H(2,2) * v + H(2,3)) ./ z_ ;
im2_ = vl_imwbackward(im2double(im2),u_,v_) ;
mass = ~isnan(im1_) + ~isnan(im2_) ;
im1_(isnan(im1_)) = 0 ;
im2_(isnan(im2_)) = 0 ;
mosaic = (im1_ + im2_) ./ mass ;
figure(2) ; clf ;
imagesc(mosaic) ; axis image off ;
title('Mosaic') ;
if nargout == 0, clear mosaic ; end
end
I understand box2 is an area that's created based on the size of our second image in which the images will be stitcked. Why then, are we performing an Inverse Homography multiplication on it?
Could someone please explain the steps that follow as I'm not familiar with image mosaicing in Matlab.
답변 (2개)
khadija laaroussi
2014년 11월 26일
can you see this project: https://sites.google.com/site/computervisionadinastoica/project-2-image-mosaicing-workflow
댓글 수: 0
Soso
2015년 7월 1일
Hi Sean;
Did you get how this piece of code works? I am struggling to understand this code. Could you or someone explain to me how this works, please? Thank you in advance.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!