what's the problem with my code ? Warning: Rank deficient, rank = 1, tol = 2.574115e-12.

13 visualizaciones (últimos 30 días)
Warning: Rank deficient, rank = 1, tol = 2.574115e-12.
for following code:
X1 = [286; 206; 191; 487; 510];
Y1 = [93; 523; 333; 494; 221];
X2 = [640; 329;426; 575; 751 ];
Y2 = [241; 547;383; 684; 475 ];
n_pts = size(X1,1);
% Allocate memory for the A matrix of the linear system Ax = b
A = zeros(2*n_pts, 6);
% Define b for linear system Ax = b
b = [X2 Y2];
b = b';
b = b(:);
% Fill in the A matrix
for i = 1:n_pts+1
a = [X1 Y1];
a = a';
a = a(:);
A(:,i)=a
end
% Use least squares to solve the projective transformation parameters
params = A\b;

Respuestas (1)

Walter Roberson
Walter Roberson el 9 de Abr. de 2021
for i = 1:n_pts+1
a = [X1 Y1];
Your X1 and Y1 do not change with the iterations, so your a will be the same for all iterations
a = a';
a = a(:);
A(:,i)=a
so you are storing the same a for every column of A. The result cannot have rank more than 1.
end

Categorías

Más información sobre Polynomials en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by