Wednesday, 25 April 2012

Lab 2

During this lab, kami belajar cara-cara utk recognize the size of file(image) based on its bytes, rows and columns. Then, we learn about image acquisition. image acquisition adalah suatu proses utk process image, compress image, edit image, storage image dgn menggunakan algorithm yang sesuai. 

Question 1

(a) Copy "Porshe.tiff" into file.
  • Read the file into f
  • How large is the image(rows,columns)?
In other to complete the question, followed these instructions:

- Use command imread to read the file

>> I=imread('Porsche.tiff')

- Make sure the directory for the image is the same as your current directory.


- To check the size of the image, you can check on the workspace


           Value = <342x546 uint8>
           Row = 342
           Column = 546

         * or double click I (open I) in workspace and variable editor of I will be displayed.      


(b) Answer the following questions about the image

  •     How big is the file?

              - Use whos command to display the information of the matrix


               - Answer: 186732 bytes

  • How large is the image (rows,columns)
           - Answer: image (342, 546)

  • What are the minimum and maximum gray values?
           - Answer:
             Min = 0;
             Max = 240

  • How many bytes in the file are used to store one pixel?
          - Answer: 1 pixel consists of 8 bits. 8 bits is equal to 1 byte.




Question 2

Part I : Image Acquisition

Sample image.



Part II : Read the image into MATLAB

- Use imread  command to read the image



- To display the information of matrix I 



- Note that the class should be "uint8" and the third dimension of I should be 3, which denotes it is a colour       image (the three components responding to R, G, B channels respectively). 

- To display the image with original colour.




- To convert image into grayscale



- To display the green channel of the image



- To display the red channel of the image



Part III : Basic Image Operations

- Transport the image and display it.




- To crop the top-left quarter of the image and display it




- To flip the image from left to right and display it






No comments:

Post a Comment