Rotate an image around centroid without deformation
Mostrar comentarios más antiguos
Hey everyone. I am trying to create an image of a rectangle and rotate it 360* and save all of those images to do a comparison later. However the cell expands with imrotate and I need them to all to be the same size to do cell operations later. When I perform the crop in the last line it cuts the extra pixels from right to left, then distorting the positon of rectangle I have drawn.
Does anyone have an easy method to rotate just the rectangle 360* around its centroid but maintaining a 101*101 pixel canvas. Reference image to see how it moves off centre.
Thanks. :)

image=zeros(101,101);
image(29:78,43:60)=1; %Create a rectangular image (0 is white and 1 will be black)
for i=1:1:360
rotated{i}=imrotate(image,i); %roate the image 360 degrees
rotated{i}=rotated{1,i}(1:101,1:101); %Crop the image back down to 101x101 so cell operations can be conducted later
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Images en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
