This preview shows pages 1–2. Sign up to view the full content.
function matrix = rotImage(imarr,ang)
%Write a function called rotImage that takes in a matrix representing an
%image and an angle in degrees by which the image should be rotated.
%rotImage should then return an image matrix that represents the image
%rotated by the specified number of degrees.
%A positive angle represents a clockwise turn, while a negative angle
%represents a counterclockwise turn.
If the input angle is not
%evenly divisible by 90, then your function should return the string
%'Error: the input angle must be a multiple of 90.'
Keep in mind that
%the angle may be more than 360 degrees.
% Constraints:
%You may not use fliplr, flipud, rot90, or imrotate for this problem 
%and do not use error!
% Hint:
%
Mod will prove useful.
if mod(ang,90)==0
%determines whether the angle is divisible by 90 degrees
[r c clr] = size(imarr);
%gets the size dimensions of the image array
red = imarr(:,:,1);
%gets the first layer of the image
green = imarr(:,:,2);
%gets the second layer of the image
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up
to
access the rest of the document.
This note was uploaded on 10/21/2010 for the course CS 1371 taught by Professor Stallworth during the Spring '08 term at Georgia Institute of Technology.
 Spring '08
 Stallworth

Click to edit the document details