Starting from:
$30

$24

COM-SGN.110 EXERCISE 10

The tasks should be completed and presented to TA during the lab session. Do not forget to upload your solutions to Moodle! Questions about exercises should be addressed to the TA personally, through Moodle messages or via email, which can be found on the Moodle page of the course.










1. Color distances and slicing




Implement 2 MATLAB functions sliceCube and sliceSphere, which allow the user to choose a color from an image and suppress all the colors that are sufficiently different from the chosen one.

The functions should take an image and a distanceas inputs (≥ 0).



Use impixel to allow the user to choose a color . Note that many pixels can be chosen with one call to impixel, in which case it will return a matrix instead of an RGB vector. This case can be handled in different ways, e.g. use the first chosen pixel, or the last one, or average the colors.



Construct a distance-based image mask. sliceCube should use Manhattan distance, while sliceSphere uses Euclidean distance:
        = {
1
where | − | + | − | + |
− | ≤
0




otherwise




1
where ( 

)2 + ( 

)2 + ( 
− )2
≤ 2
= { 0






















otherwise







NB: the variable types are of major importance here, as the range of uint8 cannot fit the squared values from the above expressions. Perform calculations in double.




Use the masks to suppress dissimilar colors. Suppressed regions can be either left black or get assigned a certain color, e.g. gray (127, 127, 127).



Verify the functions on the images cheetah.jpg and chameleon.jpg. You can try your own images as well.




Noise and filtering across different colorspaces



Load the RGB image lena.tiff and convert it to HSI color space with the provided function rgb2hsi.m. Display every component of both color spaces in a 2x3 subplot (R, G, B, H, S, I).



Introduce Gaussian noise (imnoise) to the green component alone. Create a new copy of the image with noisy green channel (other channels intact) and display it. Convert the copy to HSI colorspace and display all the components in a subplot. Which of them are affected by the noise and which (if any) are not? Explain the reason.



Repeat step b), but now add Gaussian noise to all three color components. Are there any differences between the results of this step and step b)? Why/why not?



Try applying arithmetic mean filtering (imfilter, fspecial) to remove the noise and use the provided function hsi2rgb.m to convert the HSI image back to the RGB space. Which component(s) should be filtered for best results? Which will damage the image further when filtered? Demonstrate your conclusions for both RGB and HSI colorspaces.

More products