rotImage - function [matrix str] = rotImage(imarr,ang)...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
function [matrix str] = 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 counter-clockwise 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
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

rotImage - function [matrix str] = rotImage(imarr,ang)...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online