Test the compression function of imwrite. Read in the image of Lena. Save the image using imwrite with qualit factors 90%, 75%, 50%, and 25%. For each case get the file size using the function imfinfo. Display each image with a title showing it's quality factor and size in kB.
| Quality = 90%, Size = 19.648kB | Quality = 75%, Size = 11.728kB | Quality = 50%, Size = 7.982kB | Quality = 25%, Size = 5.342kB |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
Divide Lena into 8 x 8 blocks. The wavelet matrix replacing the DCT transform can be generated using the MATLAB function harrmtx.m. Apply this Haar wavelet transform to each block and threshold each block. Reconstruct the image. Display your results.
| Haar Transform | Inverse Haar Transform | Threshold? |
|---|---|---|
![]() |
![]() |
None. |
![]() |
![]() |
im2bw |
![]() |
![]() |
mat2gray |
Given the m-files mdilate and merode, implement the grayscale morphology operations of dilation and erosion. Run the test script for mdialte on the image of Lena (see assignment handout).
| Original | Dilated |
|---|---|
![]() |
![]() |
Run the test script for merode on the image of Lena.
| Original | Eroded |
|---|---|
![]() |
![]() |
Write functions mclose and mopen using the functions mdialate and merode. Test them out on the image of Lena and displa the results. Use different 3 x 3 structuring elements: a square, a disk, and an L-shaped element. Show the results.
| Original | Opened with Square | Opened with Disk | Opened with L-Shape |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
| Original | Closed with Square | Closed with Disk | Closed with L-Shape |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
Write a morphological boundary operator for a color image and test it on the color image of peppers.
| Original | Boundary |
|---|---|
![]() |
![]() |
Read in the images of the normal and cancerous cells. Convert the images from color to grayscale using rgb2gray. Use the function graythresh to convert the grayscale images to binay images.
| Color | Grayscale | Binary |
|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
As you can see, the isolated cell nuclei in the binary image appear as small 'white spots' in the black background. There are also nuclei in the objects that are not properly thresholded and appear as 'black holes' in the white structures. The objective is to eliminate the white spots and black holes while distorting the other structures as little as possible. The big holes should not be elimnated. Construct a suitable set of structuring elements and perform morphological operations using these elements. The MATLAB function you write should take the binary image as input and give the filtered image as output. The structuring elements could be defined inside the function or could be an optional input argument.
| Unfiltered | Filtered |
|---|---|
![]() |
![]() |
![]() |
![]() |
Use the black and white images you obtain from the output of the previous section and perform a morphological boundary extraction. Perform edge detection on the grayscale form of the image using one of MATLAB's built-in edge detectors (using the edge command). Compare the result with the morphological extracted boudaries from above.
| Morphological Boundary Extraction | MATLAB Sobel Filter |
|---|---|
![]() |
![]() |
![]() |
![]() |