You are on page 1of 31

Image Processing

Ch2: Digital image


Fundamentals

Prepared by: Hanan Hardan

Hanan Hardan 1
Image Acquisition:

The image is captured by a sensor (eg. Camera), and digitized if


the output of the camera or sensor is not already in digital form,
using analogue-to-digital convertor

Hanan Hardan 2
Image sampling and quantization
 In order to process the image, it must be saved on
computer.

 The image output of most sensors (eg: Camera) is


continuous voltage waveform.

 But computer deals with digital images not with continuous


images, thus: continuous images should be converted into
digital form.

Hanan Hardan 3
Image sampling and quantization
To convert continuous image (in real life) to digital image (in
computer)
we use Two processes:
1.sampling
2.quantization.

Remember that:
the image is a function f(x,y),
x and y: are coordinates
F: intensity value (Amplitude)

Sampling: digitizing the coordinate values


Quantization: digitizing the amplitude values
Thus, when x, y and f are all finite, discrete quantities, we call the image
a digital image.

Hanan Hardan 4
How does the computer digitize the continuous image?

Ex:
scan a line such as AB from the continuous image, and represent
the gray intensities.

Hanan Hardan 5
How does the computer digitize the
continuous image?

Sampling: digitizing coordinates


Quantization: digitizing intensities Gray-level scale that
divides gray-level into 8
discrete levels

Quantization:
converting each
sample gray-
level value into
discrete digital
quantity.

sample is a small white square, located by a vertical tick


mark as a point x,y Hanan Hardan 6
How does the computer digitize the
continuous image?

Now:
the digital scanned line AB
representation on computer:

The continuous image VS


the result of digital image
after sampling and
quantization

Hanan Hardan 7
Digital Image Representation
 The result of sampling and quantization is a
matrix of real numbers
Assume that an image f(x,y) is sampled so that the resulting
image has M rows and N columns. We say that the image is of
size M x N.
The values of the coordinates (x,y) are discrete quantities. For
clarity, we use integer values for these discrete coordinates.

Hanan Hardan 8
Digital Image Representation
Images as Matrices

 Each element of this array is called an


image element, picture element, pixel or pel.
 A digital image can be represented naturally
as a MATLAB matrix:

Hanan Hardan 9
Pixels!

 Every pixel has # of bits (k)


so, the gray intensities ( L ) that the pixel can hold, is calculated
according to a number of pixels it has (k).
L= 2k
Q: Suppose a pixel has 1 bit, how many gray levels can it
represent?
Answer: 2 intensity levels only, black and white.
Bit (0,1)  0:black , 1: white

Q:Suppose a pixel has 2 bit, how many gray levels can it represent?
Answer: 4 gray intensity levels
2Bit (00, 01, 10 ,11).
Now ..
if we want to represent 256 intensities of grayscale, how many bits
do we need?
Answer: 8 bits  which represents: 28=256
Hanan Hardan 10
Number of storage of bits:
N * M: the no. of pixels in all the image.
K: no. of bits in each pixel
L: grayscale levels the pixel can represent
L= 2K
all bits in image= N*N*k

Hanan Hardan 11
Number of storage of bits:
EX: Here: N=32, K=3, L = 23 =8
# of pixels=N*N = 1024 . (because in this example: M=N)
# of bits = N*N*K = 1024*3= 3072

N=M in this table, which means no. of horizontal pixels= no. of


vertical pixels. And thus:
Hanan Hardan 12

# of pixels in the image= N*N


Spatial and gray-level resolution

Hanan Hardan 13
Spatial and gray-level resolution

Resolution: How Much Is Enough?


 This all depends on what is in the image and
what you would like to do with it
 Key questions include
 Can you see what you need to see within the image?

Hanan Hardan 14
Resolution: How Much Is Enough?
(cont…)

The picture on the right is fine for counting


the number of cars, but not for reading the
number plate
Hanan Hardan 15
‫‪Spatial resolution:‬‬
‫‪‬‬ ‫‪Sampling is the principal factor determining‬‬
‫‪the spatial resolution of an image‬‬
‫‪ Basically, spatial resolution is the smallest‬‬
‫‪discernible detail in an image.‬‬
‫‪ Spatial Resolution‬‬
‫)هي وحدة قياس الصغر جزء في الصورة يمكن تمييزة بالعين‪(.‬‬
‫عدد البكسالت في الصورة ال يحدد وضوحها‪ ,‬فهو فقط يحد ابعاد الصورة ‪,‬‬
‫اما ‪ Spatial resolution‬هو المسؤول عن تحديد الوضوح ‪ ,‬فكلما‬
‫كانت البكسالت متقاربة وتحمل قيم لونيه صحيحة اكثر كان لها قدرة‬
‫اعلى على توضيح معالم الصورة بشكل اوضح‪.‬‬
‫‪Hanan Hardan‬‬ ‫‪16‬‬
How to choose the spatial resolution
Spatial resolution = Sampling locations
Original image
Sampled image

Hanan Hardan 17
Under sampling, we lost some image details!
How to choose the spatial resolution :
Original image

Sampled image

1mm

No detail is lost!
Spatial resolution
(sampling rate)

Hanan Hardan 18
Effect of Spatial Resolution
Example:

256x256 pixels 128x128 pixels

insufficient spatial
resolution 
appearance of
checkerboard pattern
in the image

Hanan Hardan 19
64x64 pixels 32x32 pixels
‫‪Example: Spatial resolution‬‬

‫الصورة في اليسار تحمل عدد بكسالت اكبر من الصورة في الجهه اليمين‬


‫‪ ,‬ومع ذالك الصورة في اليسار تبدوا غير واضحة لماذا؟‬

‫‪Hanan Hardan‬‬ ‫‪20‬‬


gray-level resolution
 Quantization is the principal factor
determining the gray level resolution of an
image
 Gray-level resolution refers to the smallest
discernible change in gray level.
‫وهي تعني اصغر تغيير في الكثافة (كثافة اللون الرمادي) يمكن تمييزها‬
‫ورؤيتها‬
Color depth/ levels is given by

L2 k

Hanan Hardan 21
Effect of Quantization Levels
Example:

256 levels 128 levels

64 levels Hanan Hardan 32 levels 22


Effect of Quantization Levels (cont.)

16 levels 8 levels
In this image,
it is easy to see
false contour.

4 levels
Hanan Hardan 2 levels 23
Digital Image Types:
 Binary image (B&W)
 Grayscale image
 Color image (RGB)

Hanan Hardan 24
Common image formats include:
 1 sample per point (B&W or Grayscale)
 3 samples per point (Red, Green, and Blue)

 For most of this course we will focus on grey-


scale images
Hanan Hardan 25
Binary Images
Binary images are images that have been
quantized to two values, usually denoted 0
and 1, but often with pixel values 0 and
255, representing black and white.

Hanan Hardan 26
Image Types : Binary Image
Binary image or black and white image
Each pixel contains one bit :
1 represent white
0 represents black

Binary data
0 0 0 0
0 0 0 0
 
1 1 1 1
 
1 1 1 1
Hanan Hardan 27
Grayscale Images

 A grayscale (or graylevel) image is simply


one in which the only colors are shades of
gray (0 – 255)

Hanan Hardan 28
Digital Image Types : Intensity Image

Intensity (monochrome or gray scale) image


each pixel corresponds to light intensity
normally represented in gray scale (gray
level).

Gray scale values


10 10 16 28
 9 6 26 37
 
15 25 13 22
 
32 15 87 39

Hanan Hardan 29
Color Images
 Color image: A color image contains pixels
each of which holds three intensity values
corresponding to the red, green, and blue
or( RGB)

Hanan Hardan 30
Digital Image Types : RGB Image

Color image or RGB image:


each pixel contains a vector
representing red, green and
blue components.

RGB components
10 10 16 28
 9 656 70 26
56  43
3756  78
 32 99 54 96  67 
70
15  256013 902296   67
  21  54 47  42 
  85 85 43  92
32 15 87 39
Hanan Hardan
54  65 65 39 31 
32 65 87 99

You might also like