Why SVD is required in estimation of homography matrix using RANSAC method? & what is the input for SVD?
조회 수: 5 (최근 30일)
이전 댓글 표시
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
sadi
2018년 3월 15일
The error says it all. Check the places where you are applying ".*" in calculation of P.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Eigenvalues에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!