Why SVD is required in estimation of homography matrix using RANSAC method? & what is the input for SVD?
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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.
2 commentaires
sadi
le 15 Mar 2018
The error says it all. Check the places where you are applying ".*" in calculation of P.
Réponses (0)
Voir également
Catégories
En savoir plus sur Eigenvalues dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!