Please remember this code : % Set points A and B according to lab.pdf question A = [5 3…
Jump to turn (6)
- 1Please remember this code : % Set points A and B according to lab.pdf question A
- 2In a real application we can only observe the positions of points before and aft
- 3code above has this error : Error using Incorrect dimensions for matrix multipli
- 4from the code below please display all the pixel matrix A and B : % Set points A
- 5please display all of the matrix before and after transformation
- 6in this code below please generate matrix N containing xtransformed, ytransforme
- User
Please remember this code :
% 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;
code% 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 end