chapter 3: image display 3.1 introduction
DESCRIPTION
Chapter 3: Image Display 3.1 Introduction. We look at image quality and how that may be affected by various image attributes For human vision in general, the preference is for images to be sharp and detailed There are many factors that will affect the display ambient lighting, - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/1.jpg)
1
Chapter 3: Image Display3.1 Introduction
• We look at image quality and how that may be affected by various image attributes
• For human vision in general, the preference is for images to be sharp and detailed
• There are many factors that will affect the displayambient lighting, the monitor type and settings, the graphics card, andmonitor resolution
![Page 2: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/2.jpg)
2
• This function image simply displays a matrix as an image
3.2 Basics of Image Display
50 100 150 200 250
50
100
150
200
250
![Page 3: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/3.jpg)
3
• To display the image properly, we need to add several extra commands to the image line
3.2 Basics of Image Display
![Page 4: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/4.jpg)
4
• We may to adjust the color map to use fewer or more colors; however, this can have a dramatic effect on the result
3.2 Basics of Image Display
![Page 5: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/5.jpg)
5
• use imread to pick up the color map
tmap is <256×3 double> in the workspace
3.2 Basics of Image Display
>> [t, tmap]=imread(‘trees.tif’);>> figure, image(t), truesize, axis off, colormap(tmap)
![Page 6: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/6.jpg)
6
• True color image will be read (by imread) as a three-dimensional array
In such a case, image will ignore the current color map and assign colors to the display based on the values in the array
3.2 Basics of Image Display
>> a=imread(‘autumn.tif’);>> figure, image(a), truesize, axis off
![Page 7: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/7.jpg)
7
• We have two choices with a matrix of type double:
Convert to type uint8 and then display
Display the matrix directly
• imshow will display a matrix of type double as a grayscale image (matrix elements are between 0 and 1)
3.3 The imshow Function
Ch3-p.44
![Page 8: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/8.jpg)
8
FIGURE 3.1>> ce=imread(‘cell.tif’); >> ced=double(ce);
>>imshow(ce) >>imshow(ced)
>>imshow(ced/255)>>imshow(ced/512) >>imshow(ced/128)
![Page 9: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/9.jpg)
9
• We can convert the original image to double more properly using the function im2double
• If we take cd of type double, properly scaled so that all elements are between 0 and 1, we can convert it back to an image of type uint8 in two ways:
3.3 The imshow Function
>> ced1=im2double(ce); >> imshow(ced1)
>> ce1=uint8(255*ced1);>>ce2=im2uint8(ced1);
![Page 10: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/10.jpg)
10
• BINARY IMAGES MATLAB have a logical flag, where uint8 values 0 and 1 can be interpreted as logical data
• Check c1 with whos
3.3 The imshow Function
![Page 11: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/11.jpg)
11
FIGURE 3.3
>> imshow(uint8(cl))>> imshow(cl)
![Page 12: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/12.jpg)
12
• Grayscale images can be transformed into a sequence of binary images by breaking them up into their bitplanes
• The zeroth bit plane the least significant bit plane
• The seventh bit plane the most significant bit plane
3.4 Bit Planes
![Page 13: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/13.jpg)
13
3.4 Bit Planes
• We start by making it a matrix of type double; this means we can perform arithmetic on the values
![Page 14: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/14.jpg)
14
FIGURE 3.4• Least significant bit
plane
• Most significant bit plane
![Page 15: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/15.jpg)
15
3.5 Spatial Resolution
• The greater the spatial resolution, the more pixels are used to display the image
• We can experiment with spatial resolution with MATLAB’s imresize function>> imresize(x,1/2);
![Page 16: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/16.jpg)
16
3.5 Spatial Resolution
imresize(imresize(x, factor, ‘imresize(imresize(x, factor, ‘nearestnearest’), factor, ‘’), factor, ‘nearestnearest’);’);
>> x2=imresize(imresize(x,1/2),2);
• Pixelization
![Page 17: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/17.jpg)
17
FIGURE 3.5
![Page 18: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/18.jpg)
18
FIGURE 3.6
![Page 19: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/19.jpg)
19
FIGURE 3.7
![Page 20: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/20.jpg)
20
3.6 Quantization and Dithering
• Uniform quantization
![Page 21: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/21.jpg)
21
3.6 Quantization and Dithering• To perform such a mapping in MATLAB, we can perform
the following operations, supposing x to be a matrix of type uint8
• There is, a more elegant method of reducing the grayscales in an image, and it involves using the grayslice function
![Page 22: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/22.jpg)
22
FIGURE 3.9
![Page 23: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/23.jpg)
23
FIGURE 3.10
![Page 24: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/24.jpg)
24
FIGURE 3.11
![Page 25: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/25.jpg)
25
FIGURE 3.12
![Page 26: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/26.jpg)
26
3.6 Quantization and Dithering• DITHERING In general terms, refers to the process
of reducing the number of colors in an image• Representing an image with only two tones is also
known as halftoning• Dithering matrix
• D or D2 is repeated until it is as big as the image matrix, when the two are compared
![Page 27: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/27.jpg)
27
• Suppose d(i, j) is the matrix obtain by replicating the dithering matrix, then an output pixel p(i, j) is defined by
3.6 Quantization and Dithering
![Page 28: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/28.jpg)
28
FIGURE 3.14
DD2
![Page 29: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/29.jpg)
29
3.6 Quantization and Dithering
• Dithering can be extended easily to more than two output gray values
• For example, we wish to quantize to four output levels 0, 1, 2, and 3
(Since 255/3 = 85)
![Page 30: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/30.jpg)
30
FIGURE 3.15>> D = [0 56; 84 28];>> r = repmat(D, 128, 128);>> x = double(x);>> q = floor(x/85);>> x4 = q+(x-85*q>r);>> imshow(uint8(85*x4))
>> D = [0 24; 36 12];>> r = repmat(D, 128, 128);>> x = double(x);>> q = floor(x/37);>> x8 = q+(x-37*q>r);>> imshow(uint8(37*x8))
![Page 31: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/31.jpg)
31
3.6 Quantization and Dithering• ERROR DIFFUSION
The image is quantized at two levelsFor each pixel we take into account the error between
its gray value and its quantized valueThe idea is to spread this error over neighboring pixels
• Floyd and Steinberg methodFor each pixel p(i, j) in the image we perform the
following sequence of steps:1. Perform the quantization2. Calculate the
quantization error
![Page 32: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/32.jpg)
32
3.6 Quantization and Dithering3. Spread this error E over pixels to the right and
below according to this table
![Page 33: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/33.jpg)
33
FIGURE 3.17
![Page 34: Chapter 3: Image Display 3.1 Introduction](https://reader036.vdocument.in/reader036/viewer/2022081419/568151be550346895dbff119/html5/thumbnails/34.jpg)
34
FIGURE 3.18