How to find landmarks of a rotated image?
2 views (last 30 days)
Show older comments
Westin Messer
on 26 Jan 2018
Answered: Arun Mathamkode
on 2 Feb 2018
I have an image that I placed five landmarks on and I rotated that image 30 degrees. How do I now find those five landmarks and note their position?
I = imread('peppers.png');
RGB = insertMarker(I,[147 279]);
pos = [120 248;195 246;195 312;120 312];
color = {'red','white','green','magenta'};
RGB = insertMarker(RGB,pos,'x','color',color,'size',10);
figure (1)
imshow(RGB);
title('5 Landmarks')
J = imrotate(I,30,'bilinear','crop');
figure (2)
imshow(J)
title('Rotated Image')
0 Comments
Accepted Answer
Arun Mathamkode
on 2 Feb 2018
You can create a rotation matrix T and multiply the location vector of landmark points with T to find the locations of landmark points in the rotated image.
theta = 30;
T=[cosd(theta) sind(theta) ; ...
-sind(theta) cosd(theta)];
new_pos=(T*pos')';
0 Comments
More Answers (0)
See Also
Categories
Find more on Image Processing Toolbox 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!