<< pdist Image_Processing_Tool_3 sierra >>

Image_Processing_Tool_3 >> Image_Processing_Tool_3 > rot90

rot90

It rotates a matrix anti-clockwise by 90 degrees for a specified number of times.

Calling Sequence

y = rot90(x)
y = rot90(x,k)

Parameters

x

A matrix or 2-d array which will be rotated by 90 degrees.

k

A positive integer to indicate how many times the given matrix is to be rotated by 90 degrees.

y

A matrix representing output obtained after rotating the input matrix k times by 90 degrees.

Description

It rotates a matrix k times in anti-cockwise direction by 90 degrees. If the input parameter is misssing in the input, it value is taken as 1 and the input matrix is rotated by 90 degree. If k=2,3 or 4, the given matrix is rotated by 180, 270 or 360 degrees. If the value of k is greater than 4, the remainder of k when divided by 4 is taken as the value of k. That is if k=11, then k is taken as 3, that is the input matrix will be rotated by 270 degree.

Examples

// reading an image
x=imread('lena.png');
x=rgb2gray(x);
// rotate the image by 90 degree
y=rot90(x);
imshow(uint8(y))

// rotate the image by 270 degree
y1=rot90(x,3);
imshow(uint8(y1))

See Also

Authors

<< pdist Image_Processing_Tool_3 sierra >>