Why SVD is required in estimation of homography matrix using RANSAC method? & what is the input for SVD?

5 Ansichten (letzte 30 Tage)
Hello, I have tried a code given for imagestitching. But I am getting error in the following function: in P matrix calculation.
function [P,S,V,q,A] = estimateTransform(img1_points,img2_points)
%%Initialization
%format long
ncorr = length(img1_points);
%%Setting the P matrix 10x9
P = [img1_points(1:ncorr,:),ones(ncorr,1),zeros(ncorr,3),...
-1*img2_points(1:ncorr,1).*img1_points(1:ncorr,:),...
-1*img2_points(1:ncorr,1);...
zeros(ncorr,3),-1*img1_points(1:ncorr,:),-1*ones(ncorr,1),...
img2_points(1:ncorr,2).*img1_points(1:ncorr,:),...
img2_points(1:ncorr,2)];
%%Calculating r 8x1
%r = img2_points(:);
%%SVD Decomposition
[~,S,V] = svd(P);
%%Extracting Diagonal elements of S
sigmas = diag(S);
%%Detecting minimum diagonal element
if length(sigmas) >= 9 %trivial solution
minSigma = min(sigmas);
[~,minSigmaCol] = find(S==minSigma);
%%Calculating q
q = double(vpa(V(:,minSigmaCol)));
elseif length(sigmas)<9 %non-trivial solution
%%Calculating q
q = double(vpa(V(:,9)));
end
%%Calculating A
A = reshape(q,[3,3])';
end
The error is: in .* the dimension must agree. Somebody please help me.

Antworten (0)

Kategorien

Mehr zu Eigenvalues finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by