umbe1987
umbe1987

Reputation: 3588

MATLAB imrotate back to original size and orientation

I have used imrotate function to rotate an image without using the 'crop' argument and now after some processing I would like to imrotate back to have the original orientation and size. Is there a way to do that, maybe with other functions other than imrotate?

Upvotes: 1

Views: 990

Answers (1)

Daniel Heilper
Daniel Heilper

Reputation: 1250

If the rotation angle is not a multiple of 90' - 0', 90', 180', ... , There is no way to rotate back and get the exact original image. The reason is that the rotation of an image is a non-linear transformation - see in mathworks-ref-imrotate. The rotation is performed using interpolation, where the default is "nearest". In your case theta=332' the transformation is non preserving.

So the answer is no.

Note: For theta = K*90' there is a linear transformation - 2X2 rotation matrix, and also you can use a combination of flip and transpose: easiest-way-to-transpose-an-image-rotate-by-90-degrees-using-opencv

Upvotes: 1

Related Questions