フィルターのクリア

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

6 ビュー (過去 30 日間)
swathi
swathi 2018 年 3 月 11 日
コメント済み: swathi 2018 年 3 月 19 日
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
sadi 2018 年 3 月 15 日
The error says it all. Check the places where you are applying ".*" in calculation of P.
swathi
swathi 2018 年 3 月 19 日
Ya..Error is cleared. Thank you.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by