Tuesday, 13 March 2012

Lab 3 - Part 1

Image Processing Toolbox Tutorial

In today's lecture, we learned some basic topic about Image Processing and Pattern Recognition using Matlab Tool. This tutorial consist of:


  1. Read and display an Image
  2. Check how the image appear in the workspace
  3. Perform histogram equalisation on the image
  4. Write the image to a disk file
  5. Get info about graphic file

1. Read and display image
To read an image, use imread command. Lets read the image in PNG format and show the image on your workspace by using imshow command


2. Check the image memory
Enter the whos  command to see how the I variable stored in the library.



3. Perform histogram equalisation


As you can see, pout2.png is a low contrast image. To see the distribution of intensities in pout2.png in its current state, you can create a histogram by calling the imhist function.


Notice how the intencity range is rather narrow

Now call histeq(I) to spread the intensity values over the full range, thereby improving the contrast of I. Return the modified image in variable I2


Display the new equalised image, I2 using this command. 



Call imhist again this time for I2



4. Write the Image
Write the newly adjusted image I2 back to disk. Let say you like to save it as TIF file. Use imwrite and specify the filename includes the extension 'tif'



5. Check the content of the newly written file
Use imfinfo function to see what was written to the disk.




Now you have two same image with different format.




0 comments: