How can I register (merge) two images using homography matrix?
14 views (last 30 days)
Show older comments
I'm working on registering (merging) two images from different two cameras. For that I've done...
- calibrate each camera alone to get points. (The images for checkerboard, and cameras are above each other).
- By using the points, I've calculated the homography matrix.
x = up(1,:); y = up(2,:); xd = down(1,:); yd = down(2,:);
npoints = size(up,2);
A = zeros(2*npoints,9);
for i = 1:npoints
A(2*i-1,:) = [x(i), y(i), 1, 0, 0, 0, -x(i)*xd(i), -xd(i)*y(i), -xd(i)];
A(2*i,:) = [0, 0, 0, x(i), y(i), 1, -x(i)*yd(i), -yd(i)*y(i), -yd(i)];
end
[u,s,v] = svd(A);
h = v(:,9);
H = reshape(h,3,3);
H = H';
And I've checked the homography matrix by sum(sum(H.^2,2),1) (which is equal to 1).
The problem is the merging did not work well. What shall I do?
3 Comments
Matt J
on 18 Jun 2021
Mouaz Alsamman 's comment moved here:
have you finished this, I'm currently doing the same thing but stock on how to merge the two images.
See Also
Categories
Find more on Camera Calibration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!