|
Finally, we can attenuate and amplify the color intensities depending on a threshold. Consider setting the intensity of a pixel to 0 if it is below the threshold and 255 if it is above the threshold:
cartman=imread('cartmancop.jpg'); l=size(cartman); for i=1:l(1) for j=1:l(2) for k=1:3 if (cartman(i,j,k) > 100) cartman(i,j,k) = 255; else cartman(i,j,k) = 0; end end end end end image(cartman);
With this effect the image is reduced to a very small number of colors, namely the most extreme ones: Black (0,0,0), Red (255,0,0), Green (0,255,0), Blue (0,0,255), Yellow (255,255,0), Magenta (255,0,255), Cyan (0,255,255), and White (255,255,255).
|
|
Figure 4.5 Click to enlarge
|
|