can anyone solve the following error, that comes in the below given code lines in the code of SolveHomo, in the image mosaic.

4 vues (au cours des 30 derniers jours)
The following error occurred converting from struct to double:
Error using double
Conversion to double from struct is not possible.
program code lines:
n = size(pts1,2);
A = zeros(2*n,9);
A(1:2:2*n,1:2) = pts1';
A(1:2:2*n,3) = 1;
A(2:2:2*n,4:5) = pts1';
A(2:2:2*n,6) = 1;
  5 commentaires
Rochan Patel
Rochan Patel le 3 Oct 2013
Modifié(e) : Walter Roberson le 3 Oct 2013
function H = solveHomo(pts1,pts2)
% H is 3*3, H*[pts1(:,i);1] ~ [pts2(:,i);1], H(3,3) = 1
% the solving method see "projective-Seitz-UWCSE.ppt"
n = size(pts1,2);
A = zeros(2*n,9);
A(1:2:2*n,1:2) = pts1';
A(1:2:2*n,3) = 1;
A(2:2:2*n,4:5) = pts1';
A(2:2:2*n,6) = 1;
x1 = pts1(1,:)';
y1 = pts1(2,:)';
x2 = pts2(1,:)';
y2 = pts2(2,:)';
A(1:2:2*n,7) = -x2.*x1;
A(2:2:2*n,7) = -y2.*x1;
A(1:2:2*n,8) = -x2.*y1;
A(2:2:2*n,8) = -y2.*y1;
A(1:2:2*n,9) = -x2;
A(2:2:2*n,9) = -y2;
[evec,~] = eig(A'*A);
H = reshape(evec(:,1),[3,3])';
H = H/H(end); % make H(3,3) = 1
end

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Dates and Time dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by