You are on page 1of 29

Nitte Meenakshi Institute of Technology

(A Unit of Nitte Education Trust(R), Mangalore)


(AN AUTONOMOUS INSTITUTION AFFILIATED TO VISVESVARAYA TECHNOLOGICAL UNIVERSITY, BELGAUM)
APPROVED BY UGC, ACCREDITED BY NATIONAL BOARD OF ACCREDITATION (AICTE), NEW DELHI & NAAC
P.B. No. 6429, Yelahanka, Bangalore 560-064,

ALGORITHMS FOR IMAGE AND VIDEO PROCESSING

CSE, ECE, EEE, ISE,


SEM 6
BATCH 2016

Course Instructor:
Dr. Jharna Majumdar
Dean R & D
Professor and Head, Department of CSE(PG)
Head. Centre For Robotics Research

Open Elective Sem 6 1


UNIT I

TOPIC 5: IMAGE RESOLUTION, STORAGE, CONVOLUTION

Open Elective Sem 6 Dr. Jharna Majumdar 3


Grey Level of an Image

k represents the no. of bits used to express grey level (pixel


brightness)
Due to processing, storage and sampling hardware
consideration, the number of grey level is an integer power of 2
L = 2k

For 8 bit per pixel, it is 28 = 256


For 6 bit per pixel, it is 26 = 64
For 4 bit per pixel, it is 24 = 16
For 2 bit per pixel, it is 21 = 2

Open Elective Sem 6 Dr. Jharna Majumdar 4


Dynamic Range of an image

Range of values spanned by the grey scale is called the Dynamic


Range of an image
Discrete levels are equally spaced and they are integers in the
interval o to L-1

A High Contrast Image - Images whose grey scale occupies a


significant portion of the grey scale having high Dynamic Range
A Low Contrast image - Images whose grey scale occupies a
small portion of the grey scale having low Dynamic Range

Open Elective Sem 6 Dr. Jharna Majumdar 5


Distinguish between Gray Level Resolution and Spatial Resolution

Gray Level Resolution

Gray-level Resolution of an image is a term that refers to the number


of shades of gray that is used for displaying the image. Variations in
gray-level resolution affect the appearance of the image

Spatial Resolution of an image is the physical size of a pixel in that


image; i.e., the area in the scene that is represented by a single pixel
in that image,

Open Elective Sem 6 Dr. Jharna Majumdar 6


Commonly available grey level of an image

8 bits are used in common applications, 256 grey level

16 bits are used in specific applications ,where enhancement


of specific grey level range is required

10 or 12 bits are used in some rare application

Open Elective Sem 6 Dr. Jharna Majumdar 7


Zooming of Image

Method 1: Replicating each row and each column a number of times

Two Methods:
- Nearest Neighbor Interpolation
- Bilinear Interpolation

Method 2: Replicating each pixel a number of times

Open Elective Sem 6 Dr. Jharna Majumdar 8


Zooming - Nearest neighbor Interpolation

Zooming - Bilinear Interpolation

Open Elective Sem 6 Dr. Jharna Majumdar 9


Shrinking of Image

Method 1: Deleting row and columns


Method 2: Averaging pixel

Shrinking – Deleting rows and columns

Open Elective Sem 6 Dr. Jharna Majumdar 10


Zoom - Results

Open Elective Sem 6 Dr. Jharna Majumdar 11


Zoom - Results
Repeat the process to obtain x4, x8, x16 zoom of the original

x4

x2

x1

Open Elective Sem 6 Dr. Jharna Majumdar 13


Image Resolution – Varying Spatial Resolution

Open Elective Sem 6 Dr. Jharna Majumdar 14


Changing the grey level resolution of an image

Open Elective Sem 6 Dr. Jharna Majumdar 15


Open Elective Sem 6 Dr. Jharna Majumdar 16
Open Elective Sem 6 Dr. Jharna Majumdar 17
Image Resolution – Varying Grey Level Resolution

Original image 256X256,


subsequent images have
size (256X256)

At every step, images are


obtained by reducing the
no. of available grey
levels from 6 bits to 1 bit

Example of varying Quantization level (a) 6 bits, (b) 4 bits, (c) 2 bits, (d) 1
bit

Open Elective Sem 6 Dr. Jharna Majumdar 18


L=256,128,64,32,16,8,4,2

256
128

64 32
16 8

4 2
Storage

No. of bits required to store a digitized image


For Grey scale image, size MXN
M = No. of rows , N = No. of Columns
No. of bits required to store a digitized image
b=MXNXk
If No. of rows = No. of Columns, M = N,
b = N2 k
Example : Image size : 512 x 512
No. of gray level : 28
No. of bits required 512 x 512 x 8 bits

Open Elective Sem 6 Dr. Jharna Majumdar 21


For Color Image

Size MXN

No. of bits required to store a digitized image


b=MXNXkx3

Example : Image size : 512 x 512 x 3


color level : 16 million colors
No. of bits required 512 x 512 x 8 x 3 bits

Open Elective Sem 6 Dr. Jharna Majumdar 22


Convolution - What it is ?

 Convolution is a simple mathematical operation which is


fundamental to many common image processing operators
 Convolution mask is usually used in spatial domain to detect the
desired property of an image
 Convolution can be used in image processing to implement
operators whose output pixel values are simple linear
combinations of certain input pixel values

Two elements required for convolution are :

 Image: input image in the form of a 2D array

 Kernel or mask: two dimensional array much smaller in


size. Size of the mask could be (3X3), (5X5), (7x7) etc.

Open Elective Sem 6 Dr. Jharna Majumdar 23


Convolution – How to compute ?

K11 K12 K13


K21 K22 K23
K31 K32 K33

An example: image and kernel to illustrate convolution

Open Elective Sem 6 Dr. Jharna Majumdar 24


Convolution – How to compute ? (Contd…)
The value of the bottom right pixel in the output image will be given by:

I58=I47K11+I48K12+I49K13+I57K21+I58K22+I59K
23+I67K31+I68K32+I69K33

Mathematical Formulation

Image size: (M X N)
Kernel size: (m X n)
Size of the output image: (M - m + 1 X N - n + 1 )
i runs from 1 to M - m + 1 and j runs from 1 to N - n + 1.

Open Elective Sem 6 Dr. Jharna Majumdar 25


Convolution Mask (Contd…)

(x - 1 , y - 1 ) ( x - 1 , y) ( x - 1 , y + 1)
w1 w2 w3
w4 w5 w6 ( x , y - 1) (x,y) (x,y+1)

w7 w8 w9
(x + 1 , y - 1) (x+1,y) (x+1,y+1)

Generalized format of a convolution mask

W1, W2, ….. W9 are the mask coefficients for the 8 neighbors of (x, y)
h[ f( x , y ) ] = w1f( x - 1 , y - 1 ) + w2f( x - 1 , y ) + w3f( x - 1 , y + 1) +
w4f( x , y - 1) + w5f( x , y ) + w6f( x , y + 1 ) + w7f( x + 1 , y - 1 ) + w8f(x +
1 , y ) + w9 f(x + 1 , y + 1)

Open Elective Sem 6 Dr. Jharna Majumdar 26


Exercise : To remove bad pixels of an image matrix

Solution : The sample image matrix is having gray values ranging


from 0 to 15. Bad pixels can be removed by taking average of 4 or 8
neighbors around the pixel

 9 10 10 11 12
 9 10 10 12 13
 
9 x 10 13 14
 
 9 10 10 13 13 
10 11 11 14 12

Case 1 Average of 4 – neighbors

N(10)
N (10)

W (9) 10 + 10 + 10 + 9 39
W (9)
X E (10)
⊗= = = 9.7 ≅ 10
E
(10)
4 4
S (10)

Open Elective Sem 6 Dr. Jharna Majumdar 27


Case 2 Average of 8 – neighbors

N (10)
NW( 9)
NE (10)

W (9) X E (10)

SE (10)
SW (9)
S (10)

10 + 10 + 10 + 10 + 10 + 9 + 9 + 9 77
⊗= = = 9.6 ≅ 10
8 8

Case 3 Average of Diagonal neighbors ???

Open Elective Sem 6 Dr. Jharna Majumdar 28


Open Elective Sem 6 Dr. Jharna Majumdar 29
Open Elective Sem 6 Dr. Jharna Majumdar 30

You might also like