Question
Write Matlab function Rot 90 that rotates an image by 90 clockwise, and write Matlab function Rot 180 that rotates an image by 180 The
Write Matlab function Rot 90 that rotates an image by 90 clockwise, and write Matlab function Rot 180 that rotates an image by 180 The image may be colour or grayscale. Use an if statement to distinguish between the two cases. Your code must be written from scratch; the only allowed operations to perform the rotation are array indexing, array transposition, and the built-in function flip (see documentation; you will need to use an optional argument when calling flip). You must not use any rotation functions provided by Matlab, and you must not use any for loops or while loops. You are not required to pre-allocate the array that will store the rotated image before you start the computation. Hint: Draw a rectangle on a piece of paper and label its four corners A.B.C.D. Observe how the operations of rotation, transposition, and flip (two cases) operate on the four corners of the rectangle. If you get the four corners positioned correctly, then the rest of the array will fall into place too. 1
Part (b) Read the image sherlock.jpg from Matlab's bank of images. Display the image. Apply your functions Rot90 and Rot180 to this image and display the output of your functions, that is, the two rotated images.
Part (c) Read the image logo.tif from Matlab's bank of images. Display the image. Apply your functions Rot90 and Rot180 to this image and display the output of your functions, that is, the two rotated images.
Part (d) Suppose that the colour intensities are given as double numbers in the interval (0,1). Suppose that we apply to each pixel and to each of the three colour intensities the trans- formation r H 204 What is the relationship between the new image and the original image? Explain your reasoning. (Comment: This transformation can be used as a \"filter\" to enhance the quality of an image that was obtained in sub-optimal circumstances. Image editors such as GIMP or Photoshop, and also Matlab, implement many such filters.)
Part (e) Read the image lowlight-2.jpg from Matlab's bank of images. Note that the image uses the unsigned integer representation for colour intensities. Convert the image to the representation that uses double floats in [0,1]. Apply the transformation 1 H 2.4 to all pixels and all colour intensities, as discussed in part (d). Your Matlab code for this part must not use any for-loops or while-loops.
Part (f) Display the original image lowlight-2.jpg and display the new, transformed image which you computed upon completing part (e) above. You should observe a validation of your conclusion that you made in part (d).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started