what's the problem with my code ? Warning: Rank deficient, rank = 1, tol = 2.574115e-12.
13 views (last 30 days)
Show older comments
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;
0 Comments
Answers (1)
Walter Roberson
on 9 Apr 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
0 Comments
See Also
Categories
Find more on Polynomials in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!