please remember that this is the correct code for implementing transformation matrices…
- User
please remember that this is the correct code for implementing transformation matrices in the given image :
% Set points A and B according to lab.pdf question A = [5 3 4 2; 5 1 3 -1; 1 1 1 1]; B = [-1 1 0 2; 7 3 5 1; 1 1 1 1];
% Transformation matrices calculation T = B / A;
im = double(imread('./smile.png'));
[row_im, column_im] = size(im);
figure set(gcf,'Color',[1 1 1])
for x = 1:column_im for y = 1:row_im % Transform the point (x,y,1) using the transformation matrix T original_point = [x; y; 1]; transformed_point = T * original_point;
% Extract the transformed coordinates x_transformed = transformed_point(1); y_transformed = transformed_point(2); z_transformed = transformed_point(3); % Plot the transformed point if im(y, x) == 255 plot3(x_transformed, y_transformed, z_transformed, 'ro', 'MarkerFaceColor', 'none', 'MarkerEdgeColor', 'none') grid on else plot3(x_transformed, y_transformed, z_transformed, 'r.') end hold on drawnow endend
%original version for x = 1:column_im for y = 1:row_im if im(y,x) == 255 plot3(x, y, 1, 'ro', 'MarkerFaceColor', 'none', 'MarkerEdgeColor', 'none') grid on else plot3(x,y,1,'k.') end hold on drawnow end end
% Release the hold on the plot hold off
- Assistant
- User
from the code above, could you remove these noising points and capture the transformation matrix between the points A and B(an approximate solution is also fine) ?
- Assistant
- User
could you please provide the full code with removed noise as per your suggestion?
- Assistant
- User
the code above cause an error Error using * Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To operate on each element of the matrix individually, use TIMES (.*) for elementwise multiplication.
Error in test10 (line 26) transformed_point = T_approx * original_point;
- Assistant