rotate image 90 degrees in matlab

To rotate an image 90 degrees clockwise or counterclockwise in MATLAB, you can use the imrotate function. The following code shows an example of rotating an image called original_image by 90 degrees clockwise:

main.m
rotated_image = imrotate(original_image, -90);
47 chars
2 lines

Note that the second argument of imrotate specifies the rotation angle in degrees. A negative value indicates a clockwise rotation.

If you want to rotate the image counterclockwise by 90 degrees, you can change the second argument to a positive value:

main.m
rotated_image = imrotate(original_image, 90);
46 chars
2 lines

After running the code, the rotated_image variable contains the rotated image. You can display the image using the imshow function:

main.m
imshow(rotated_image);
23 chars
2 lines

gistlibby LogSnag