P R ES EN T ED BY
EM A N T A R EK
Digital Image
Processing
An Introduction to Digital Image Processing
with GNU Octave
2
1. Binary: Each pixel is just black or white. Since there are only two possible
values for each pixel (0,1), we only need one bit per pixel.
2. Grayscale: Each pixel is a shade of gray, normally from 0 (black) to 255
(white). This range means that each pixel can be represented by eight bits,
or exactly one byte. Other greyscale ranges are used, but generally they are
a power of 2.
3. True Color, or RGB: Each pixel has a particular color; that color is described
by the amount of red, green and blue in it. If each of these components has
a range 0–255, this gives a total of 2563 different possible colors. Such an
image is a “stack” of three matrices; representing the red, green and blue
values for each pixel. This means that for every pixel there correspond 3
values.
Types of digital image
3
1. Binary Image
• Binary: two possible values for each pixel, we only need one bit per
pixel.
• Each pixel is just black or white.
4
2. Grayscale Image
 Grayscale: Each pixel is a shade of grey, normally from .
 means that each pixel can be represented by eight bits, or exactly one
byte.
5
3. Color Image
 True color or RGB: here each pixel has a particular color, that color
being described by the amount of red, green and blue in it.
 Such an image may be considered as consisting of a stack of three
matrices; representing the red, green and blue values for each pixel.
 This means that for every pixel there correspond three values.
6
4. Indexed Image
 Indexed: Most color images only have a small subset of the more than
sixteen million possible colors.
 For convenience of storage and le handling, the image has an
associated color map.
7
Image Types
8
Example 4
Given the image ’’Lion.jpg’’, write a Matlab program to generate all
different image types and display all of them.
9
Example 5
Write a Matlab program that read an RGB image then separate it’s
three color channels.
10
Example 5 Cont.
Write a Matlab program that read an RGB image then separate it’s
three color channels.
11
Example 5 Cont.
Write a Matlab program that read an RGB image then separate it’s
three color channels.
12
Example 6
Convert intensity image to index image
gray2ind - intensity image to index image
A=Imread(‘ cameraman.tif’);
[indimg,map]=Gray2ind(A);
Indexed image
Grayscale image
13
Example 6 Cont.
Convert index image to intensity image
ind2gray - indexed image to intensity image
Code
Load trees
Imshow(X,map)
Grayimg=Ind2gray(X,map);
Imshow(Grayimg)
Indexed image
Grayscale image
14
Impixel(i,j) function
 A useful function for obtaining RGB values is impixel
returns the red, green, and blue values of the
pixel at column 200, row 100.
 This command also applies to grayscale images:
return three values, but since g is a single
two-dimensionalmatrix, all three values
will be the same.
15
Iminfo() function
16
Iminfo() function
we can see :
 the size of the image in pixels,
 the size of the file (in bytes),
 the number of bits per pixel (this is given by BitDepth),
 and the color type (in this case indexed).
17
Simultaneous Contrast
There are a number of things to bear in mind:
Observed intensities vary as to the background.
18
Example 7
19
 Spatial resolution is the density of pixels over the image:
 The greater the spatial resolution, the more pixels are used
to display the image.
 We can experiment with spatial resolution
with imresize function.
Suppose we have an 256*256 8-bit
grayscale image saved to the matrix x.
Then the command:
 will halve the size of the image….
Spatial Resolution
20
 B=imresize(A,scale)
 If scale is between 0 and 1 the return is less than the actual size.
 If scale is greater than 1the return is greater than the actual size.
Imresize() Function
21
 Greyscale images can be transformed into a sequence of
binary images by breaking them up into their bit-planes.
 We consider the grey value of each pixel of an 8-bit image
as an 8-bit binary word.
 The 0th bit plane consists of the last bit of each grey value.
 Since this bit has the least effect (least significant bit
plane).
 The 7th bit plane consists of the first bit in each value (most
significant bit plane).
Bit Planes
22
Bit plane Slicing
Instead of highlighting gray level images, highlight the contribution
made by specific bits s to total image appearance
23
Bit plane Slicing
plane 0  contains the lowest order bit of all the pixels in the image.
plane 7  contains the highest order bit of all the pixels in the image.
24
Bit plane Slicing
25
Bit plane Slicing
26
Example 8
Write a Matlab program that generate all bit planes of a gray scale
image
27
Example 8 Cont.
28
Bit plane Slicing
• Image reconstruction using n bit planes

Sec 2.pdf

  • 1.
    P R ESEN T ED BY EM A N T A R EK Digital Image Processing An Introduction to Digital Image Processing with GNU Octave
  • 2.
    2 1. Binary: Eachpixel is just black or white. Since there are only two possible values for each pixel (0,1), we only need one bit per pixel. 2. Grayscale: Each pixel is a shade of gray, normally from 0 (black) to 255 (white). This range means that each pixel can be represented by eight bits, or exactly one byte. Other greyscale ranges are used, but generally they are a power of 2. 3. True Color, or RGB: Each pixel has a particular color; that color is described by the amount of red, green and blue in it. If each of these components has a range 0–255, this gives a total of 2563 different possible colors. Such an image is a “stack” of three matrices; representing the red, green and blue values for each pixel. This means that for every pixel there correspond 3 values. Types of digital image
  • 3.
    3 1. Binary Image •Binary: two possible values for each pixel, we only need one bit per pixel. • Each pixel is just black or white.
  • 4.
    4 2. Grayscale Image Grayscale: Each pixel is a shade of grey, normally from .  means that each pixel can be represented by eight bits, or exactly one byte.
  • 5.
    5 3. Color Image True color or RGB: here each pixel has a particular color, that color being described by the amount of red, green and blue in it.  Such an image may be considered as consisting of a stack of three matrices; representing the red, green and blue values for each pixel.  This means that for every pixel there correspond three values.
  • 6.
    6 4. Indexed Image Indexed: Most color images only have a small subset of the more than sixteen million possible colors.  For convenience of storage and le handling, the image has an associated color map.
  • 7.
  • 8.
    8 Example 4 Given theimage ’’Lion.jpg’’, write a Matlab program to generate all different image types and display all of them.
  • 9.
    9 Example 5 Write aMatlab program that read an RGB image then separate it’s three color channels.
  • 10.
    10 Example 5 Cont. Writea Matlab program that read an RGB image then separate it’s three color channels.
  • 11.
    11 Example 5 Cont. Writea Matlab program that read an RGB image then separate it’s three color channels.
  • 12.
    12 Example 6 Convert intensityimage to index image gray2ind - intensity image to index image A=Imread(‘ cameraman.tif’); [indimg,map]=Gray2ind(A); Indexed image Grayscale image
  • 13.
    13 Example 6 Cont. Convertindex image to intensity image ind2gray - indexed image to intensity image Code Load trees Imshow(X,map) Grayimg=Ind2gray(X,map); Imshow(Grayimg) Indexed image Grayscale image
  • 14.
    14 Impixel(i,j) function  Auseful function for obtaining RGB values is impixel returns the red, green, and blue values of the pixel at column 200, row 100.  This command also applies to grayscale images: return three values, but since g is a single two-dimensionalmatrix, all three values will be the same.
  • 15.
  • 16.
    16 Iminfo() function we cansee :  the size of the image in pixels,  the size of the file (in bytes),  the number of bits per pixel (this is given by BitDepth),  and the color type (in this case indexed).
  • 17.
    17 Simultaneous Contrast There area number of things to bear in mind: Observed intensities vary as to the background.
  • 18.
  • 19.
    19  Spatial resolutionis the density of pixels over the image:  The greater the spatial resolution, the more pixels are used to display the image.  We can experiment with spatial resolution with imresize function. Suppose we have an 256*256 8-bit grayscale image saved to the matrix x. Then the command:  will halve the size of the image…. Spatial Resolution
  • 20.
    20  B=imresize(A,scale)  Ifscale is between 0 and 1 the return is less than the actual size.  If scale is greater than 1the return is greater than the actual size. Imresize() Function
  • 21.
    21  Greyscale imagescan be transformed into a sequence of binary images by breaking them up into their bit-planes.  We consider the grey value of each pixel of an 8-bit image as an 8-bit binary word.  The 0th bit plane consists of the last bit of each grey value.  Since this bit has the least effect (least significant bit plane).  The 7th bit plane consists of the first bit in each value (most significant bit plane). Bit Planes
  • 22.
    22 Bit plane Slicing Insteadof highlighting gray level images, highlight the contribution made by specific bits s to total image appearance
  • 23.
    23 Bit plane Slicing plane0  contains the lowest order bit of all the pixels in the image. plane 7  contains the highest order bit of all the pixels in the image.
  • 24.
  • 25.
  • 26.
    26 Example 8 Write aMatlab program that generate all bit planes of a gray scale image
  • 27.
  • 28.
    28 Bit plane Slicing •Image reconstruction using n bit planes