How can I get the new coordinates of a point after rotation of an image (2D)?
I have got the coordinates of a point (P) in my main image (2D). The main image (im) is now rotated using imrotate and the angle alpha. Now, I want to know what the coordinates of P are in the rotated image.
P = [5;8]; % coordinates of point
alpha = 45; % angle for rotation
RotatedIm = imrotate(im,alpha); % rotation of the main image (im)
RotMatrix = [cosd(alpha) -sind(alpha); sind(alpha) cosd(alpha)];
ImCenter = (size(im)/2)’; % Center of the main image
RotatedP = RotMatrix*(P-ImCenter)+ImCenter; % Rotation of point P over center of the image with angle alpha
The rotatedP coordinates are not the right ones. The problem is that there are zeros added on the borders of RotatedIm. I think that that is the reason why the coordinates of RotatedP are not correct. Can someone help me to find the coordinates of point P in the rotated image?I have got the coordinates of a point (P) in my main image (2D). The main image (im) is now rotated using imrotate and the angle alpha. Now, I want to know what the coordinates of P are in the rotated image.
P = [5;8]; % coordinates of point
alpha = 45; % angle for rotation
RotatedIm = imrotate(im,alpha); % rotation of the main image (im)
RotMatrix = [cosd(alpha) -sind(alpha); sind(alpha) cosd(alpha)];
ImCenter = (size(im)/2)’; % Center of the main image
RotatedP = RotMatrix*(P-ImCenter)+ImCenter; % Rotation of point P over center of the image with angle alpha
The rotatedP coordinates are not the right ones. The problem is that there are zeros added on the borders of RotatedIm. I think that that is the reason why the coordinates of RotatedP are not correct. Can someone help me to find the coordinates of point P in the rotated image? I have got the coordinates of a point (P) in my main image (2D). The main image (im) is now rotated using imrotate and the angle alpha. Now, I want to know what the coordinates of P are in the rotated image.
P = [5;8]; % coordinates of point
alpha = 45; % angle for rotation
RotatedIm = imrotate(im,alpha); % rotation of the main image (im)
RotMatrix = [cosd(alpha) -sind(alpha); sind(alpha) cosd(alpha)];
ImCenter = (size(im)/2)’; % Center of the main image
RotatedP = RotMatrix*(P-ImCenter)+ImCenter; % Rotation of point P over center of the image with angle alpha
The rotatedP coordinates are not the right ones. The problem is that there are zeros added on the borders of RotatedIm. I think that that is the reason why the coordinates of RotatedP are not correct. Can someone help me to find the coordinates of point P in the rotated image? imrotate, rotation matrix MATLAB Answers — New Questions