You are on page 1of 61

DIGITAL IMAGE PROCESSING

LECTURE # 1

INTRODUCTION

8th March, 2018 Dr. Ali Javed


Contact Information
2

 Course Instructor: Dr. Ali Javed


Assistant Professor
Department of Software Engineering
U.E.T Taxila

 Email: ali.javed@uettaxila.edu.pk
 Website: http://fms.uettaxila.edu.pk/Profile/ali.javed
 Contact No: +92-51-9047747
 Office hours:
 Monday, 11:00 - 12:00, Office # 7 S.E.D
 Wednesday, 02:10 - 03:10, Office # 7 S.E.D

 Lab Instructor: Engr. Nazia

 Course TA: Adil Mushtaq

Dr. Ali Javed


Books
3

 Gonzalez, R. C. and Woods, R. E., Digital Image


Processing, Third Edition, Pearson-Prentice Hall,
Inc., 2008.

 Gonzalez, R. C., Woods, R. E., and Eddins, S. L.,


Digital Image Processing Using MATLAB®,
Pearson-Prentice Hall, Inc., 2004, ISBN 81-
7758-898-2.

 Digital Image Processing and Analysis by Scott E


Umbaugh, 2nd edition, 2011

Dr. Ali Javed


Links and Reference Material
4

 http://www.mathworks.com/index.html
 http://opencv.willowgarage.com/wiki/
 http://sourceforge.net/projects/opencvlibrary/

Dr. Ali Javed


Grading Criteria
5

 Grading
 Mid Exam - 30%
 Final Exam - 50%
 Quiz - 10 %
 Assignment - 10 %

Dr. Ali Javed


Quizzes and Assignments
6

 Quiz- 4 quizzes
 2 before mid exam
 2 after mid exam

 Assignment- 4 assignments
 2 before mid exam
 2 after mid exam

Dr. Ali Javed


7 Course Outline
 Introduction to Digital Image Processing
 Applications of Digital Image Processing
 Digital Image Fundamentals
 Image enhancement in spatial domain
 Image enhancement in frequency domain
 Color Image Processing
 Image Compression
 Morphological Image Processing
 Real time Applications and Problems in DIP

Dr. Ali Javed


8 Course Learning Outcomes
At the end of the course, students are expected to;:
1. demonstrate in-depth knowledge of image and 2-D signal processing
and use their mathematical interpretation.

2. analyze and design various transformation functions/filters for image


enhancement, compression, morphology for binary, grayscale and color
images.

3. devise and evaluate algorithms for real-time problem solving using tools
like MATLAB and MS Visual Studio with OpenCV by conducting
independent/ group study.

Dr. Ali Javed


CLO Mapping
9

Mapping of CLO’s to taxonomy and Course Learning Outcome *BT PLO


PLO Level PLO Emphasis
At the end of the course, students are
expected to; Level
1. demonstrate in-depth knowledge of C2 1 2
image and 2-D signal processing and
use their mathematical interpretation.

C4 2 3
2. analyze and design various
transformation functions/filters for
image enhancement, compression,
morphology for binary, grayscale and C5, 3 3
color images. A2

3. devise and evaluate algorithms for


real-time problem solving using tools
like MATLAB and MS Visual Studio with
OpenCV by conducting independent/
group study.
*BT Level=Bloom’s Taxonomy Level
C(Cognitive Domain): C1(Remembering), C2(Understanding), C3(Applying),
C4(Analyzing), C5(Evaluation), C6(Creating)
*PLO Emphasis Level
1=low, 2=medium, 3=high

Dr. Ali Javed


10 Image
“A picture is worth a thousand words”
Anonymous

Dr. Ali Javed


What is an Image?
11

 Image is a source of information according to information theory

 An image may be defined as a two dimensional function f(x,y) where x and


y are spatial coordinates and amplitude of f at any pair of coordinates(x,y)
is called the intensity or Gray level of the image at that point.

Dr. Ali Javed


Digital Image
12

 When x,y and the amplitude values of f are all finite, discrete quantities, we call
the image a Digital Image.

 A digital Image is composed of a finite number of elements each of which has a


particular location and value

 These elements are referred to as Picture Elements, Image Elements, Pels or Pixels.

 In digital imaging, a pixel is the smallest piece of information in an image.

Dr. Ali Javed


Pixel
13

 Pixels are normally arranged in a regular 2-dimensional grid, and are often
represented using dots or squares

 The intensity of each pixel is variable; in grayscale images we have one color value
while in color systems, each pixel has typically three or four components such as red,
green, and blue, or cyan, magenta, yellow, and black

Dr. Ali Javed


Digital Image Processing
14

 Image Processing deals with algorithms that transform an input image into a
new image (processed image)
 DIP is the field of processing digital images by means of a digital computer

 Digital image processing focuses on two major tasks


 Improvement of pictorial information for human interpretation
 Processing of image data for storage, transmission and representation for
autonomous machine perception

Dr. Ali Javed


Image Types
15

 Binary Image
 1 Sample per point

 Gray scale Image


 1 Sample per point

 Color Image
 3 or 4 Samples per point

Dr. Ali Javed


Digital Image Representation
16

 A digital image f(x,y) is discretized both in spatial coordinates and brightness

 It can be considered as a matrix whose row column indices specify a point in the
image and the element value identifies the gray level value at that point

 Spatial discretization by Sampling

 Intensity discretization by quantization

Dr. Ali Javed


Digital Image Representation
17

Dr. Ali Javed


Digital Image Representation in MATLAB
18

 The representation of an M×N numerical array in MATLAB


 f (1,1) f (1, 2) ... f (1, N ) 
 f (2,1) f (2, 2) ... f (2, N ) 
f ( x, y )  
 ... ... ... ... 
 
 f ( M ,1) f ( M , 2) ... f (M , N )

Dr. Ali Javed


Video [8]
19

 A digital video consists of frames that are presented to the viewer's eye in rapid succession to
create the impression of movement. "Digital" in this context means both that a single frame
consists of pixels and the data is present as binary data, such that it can be processed with a
computer. Each frame within a digital video can be uniquely identified by its frame index, a
serial number.

 A shot is a sequence of frames shot uninterruptedly by one camera. In the context of shot
transition detection they are usually group into two types:
 Abrupt Transitions
 Gradual Transitions

Dr. Ali Javed


Video Transitions [8]
20

 Abrupt Transitions (Cuts) - This is a sudden transition from one shot to another, i. e.
one frame belongs to the first shot, the next frame belongs to the second shot. They
are also known as hard cuts or simply cuts.

 Gradual Transitions - In this kind of transitions the two shots are combined using
chromatic, spatial or spatial-chromatic effects which gradually replace one shot by
another. These are also often known as soft transitions and can be of various types,
e.g., wipes, dissolves, fades...

Dr. Ali Javed


Gradual Transitions [9-10]
21

 Dissolve: A dissolve is a gradual


transition from one image to another.

 The terms fade-out (also called fade


to black) and fade-in are used to
describe a transition to and from a
blank image.

 Wipe: A wipe is a type of film


transition where one shot replaces
another by travelling from one side of
the frame to another or with a special
shape.

Dr. Ali Javed


Why Image/Video?
22

 The magic of Tele-Vision


 Our vision capability is extended in space. You don’t need to travel to liberty
island NY to watch statue of liberty

Dr. Ali Javed


A Historical Overview of DIP
23

 Bartlane cable picture transmission system was a technique


invented in 1920 to transmit images over cable lines between London
and New York in 1920s. It was named after its inventors Harry G.
Bartholomew and Maynard D. McFarlane and was first used to transmit
a picture across the Atlantic in 1920. Using the Bartlane system, images
could be transmitted across the Atlantic in less than three hours. [2]

Dr. Ali Javed


A Historical Overview of DIP
24

The number of distinct gray levels coded by Bartlane system


was improved from 5 to 15 by the end of 1920s.[2]

Dr. Ali Javed


The Boom of Digital Images in the Last 20 Years
25

 Acquisition
 Digital cameras, scanners
 Infrared and microwave imaging etc

 Transmission
 Internet, satellite and wireless communication

 Storage
 CD/DVD, Blu-ray
 Flash memory

 Display
 CRT monitors, LCD monitor, LED Monitors
 PDAs, smart phones, smart watches

Dr. Ali Javed


26 Key Stages in DIP
 Image Acquisition
 Image Enhancement

 Image Restoration

 Image Compression

 Color Image Processing

 Morphological Image Processing

 Image Segmentation

 Representation and Description

 Image Recognition

Dr. Ali Javed


Key Stages in Digital Image Processing
27

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Representation
Image
&
Acquisition Description

Object
Problem Domain Recognition
Color Image Image
Processing Compression
Dr. Ali Javed
Key Stages in Digital Image Processing
28

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Representation
Image
&
Acquisition Description

Problem Domain Object


Recognition
Color Image Image
Processing Compression
Dr. Ali Javed
Image Acquisition
29

 The first stage of any vision system is the image acquisition stage.
 An image is captured by a sensor (such as a monochrome or color TV
camera) & digitized
 If the output of the camera or sensor is not already in digital form, an ADC
converter digitizes it
 Images are processed after acquisition.
 However, if the image has not been acquired satisfactorily then the intended
tasks may not be achievable

Dr. Ali Javed


Key Stages in Digital Image Processing
30

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Image Representation
&
Acquisition
Description

Problem Domain Object


Recognition
Color Image Image
Processing Compression
Dr. Ali Javed
Image Enhancement
31

 The aim of image enhancement is to improve the perception of information in images for
human viewers, or to provide better input for other automated image processing
techniques.

 Image enhancement techniques can be divided into two broad categories:

 Spatial domain methods, which operate directly on pixels, and


 Frequency domain methods, which operate on the Fourier transform of an image.

Dr. Ali Javed


Image Enhancement
32

Dr. Ali Javed


Key Stages in Digital Image Processing
33

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Representation
Image
&
Acquisition Description

Problem Domain Object


Recognition
Color Image Image
Processing Compression
Dr. Ali Javed
Image Restoration
34

 Image restoration refers to the recovery of an original signal from degraded


observations.

 The purpose of image restoration is to "compensate for" or "undo" defects which


degrade an image. Degradation comes in many forms such as motion blur, noise, and
camera misfocus.

Dr. Ali Javed


Image Enhancement vs Image Restoration
35

 Image enhancement : process image to emphasize features of the image that make the image
more pleasing to the observer or to process image so that the result is more suitable for a
specific application, is largely a subjective process.

 Image restoration : recover image from distortions to its original image, is largely an objective
process.

 Image enhancement is the improvement of digital image quality without knowledge about the
source of degradation. If the source of degradation is known, one calls the process image
restoration

Dr. Ali Javed


Key Stages in Digital Image Processing
36

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Image Object
Acquisition Recognition

Representation
Problem Domain &
Description
Color
ColorImage
Image Image
Processing
Processing Compression
Dr. Ali Javed
Morphological Image Processing
37

 Deals with Tools for extracting image components that are useful in the
representation & description of shape

Dr. Ali Javed


Key Stages in Digital Image Processing
38

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Representation
Image
&
Acquisition Description

Object
Problem Domain
Recognition
Color Image Image
Processing Compression
Dr. Ali Javed
Image Segmentation
39

 Segmentation refers to the process of partitioning a digital image into


multiple segments (sets of pixels, also known as super pixels). The goal of
segmentation is to simplify and/or change the representation of an image
into something that is more meaningful and easier to analyze

 Image segmentation is typically used to locate objects and boundaries (lines,


curves, etc.) in images

Dr. Ali Javed


Image Segmentation
40

 Image Segmentation algorithms generally are based on one of two basic properties
of intensity values:: Discontinuity and Similarity

 Through Discontinuity the approach is to partition an image based on abrupt changes


in intensity, such as edges in an image

 Through Similarity the approach is based on partitioning an image into regions that
are similar according to a set of predefined criteria. Thresholding, region growing,
region splitting and merging are examples of methods in this category

Dr. Ali Javed


Key Stages in Digital Image Processing
41

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Image Representation
Acquisition & Description

Object
Problem Domain
Recognition
Color Image Image
Processing Compression
Dr. Ali Javed
Representation and Description
42

 A segmented region can be represented by boundary pixels


or by internal pixels

 Representing region in 2 ways


 in terms of its external characteristics (its boundary)  focus on shape
characteristics
 in terms of its internal characteristics (its region)  focus on regional properties,
e.g., color, texture

 sometimes, we may need to use both ways

 The description of a region is based on its representation,


 for example a boundary can be described by its length

Dr. Ali Javed


Representation and Description
43

 Chain Codes are used to represent the boundary by a connected sequence


of straight line segments of specified length and direction

 Typically this representation is based on 4 or 8 connectivity of the segments

Dr. Ali Javed


Key Stages in Digital Image Processing
44

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Representation
Image
&
Acquisition Description

Problem Domain Object


Recognition
Color Image Image
Processing Compression
Dr. Ali Javed
Object Recognition
45

 Recognition is the process that assigns a label to an object based on its descriptors

 A pattern is an arrangement of descriptors also known as features

 A pattern class is a family of patterns that share some common properties

 Pattern recognition by machine involves techniques for assigning patterns to their


respective classes automatically and with as little human intervention as possible

Dr. Ali Javed


Key Stages in Digital Image Processing
46

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Representation
Image
&
Acquisition Description

Problem Domain Object


Recognition
Color Image Image
Processing Compression
Dr. Ali Javed
Image Compression
47

 Image compression is minimizing the size in bytes of a graphics file without


degrading the quality of the image to an unacceptable level.

 The reduction in file size allows more images to be stored in a given amount of disk
or memory space. It also reduces the time required for images to be sent over the
Internet or downloaded from Web pages.

 Image Compression methods can be based on either:

 Lossy Compression methods

 Lossless Compression methods

Dr. Ali Javed


Image Compression
48

Dr. Ali Javed


Key Stages in Digital Image Processing
49

Image Morphological
Restoration Processing

Image
Segmentation
Enhancement

Representation
Image
&
Acquisition Description

Object
Problem Domain
Recognition
Color Image Image
Processing Compression
Dr. Ali Javed
50 Image Processing Components

Dr. Ali Javed


Image Processing Components
51

 Image Sensing device

 Storage Media

 Processing Systems

 Displays [5]

 Communication Media

 Hardcopy devices (e.g Printer)

 Frame Grabber

Dr. Ali Javed


Camera
52

 Lens (CMount, CSMount) [3-4]

 Optical Filter (Selectivity in EM waves)

 Imaging Sensor (CCD Sensor ,CMOS Sensor)[6]

 Pixel count

 Optical vs Digital Zoom

 Flash (Used for lighting/Illumination)

 Front Illumination
 Back Illumination
Dr. Ali Javed
Camera Lens
53

 The function of the lens in the camera is to direct the light source to the camera
sensor to help focusing the image.

 The main difference of the different lens brands will be the coating that they use.

 Different lens coating will give varying results from sharpness to color
reproduction.

 Some "legendary" brands of camera/lens are Carl Zeiss, Leica, Schneider


Kreuchnach, etc

Dr. Ali Javed


Camera Filter/Optical Filter
54

 Camera filters alter the properties of light entering the camera lens for the purpose of
improving the image being recorded.

 The filter can be a square or oblong shape mounted in a holder accessory, or, more commonly,
a glass or plastic disk with a metal or plastic ring frame, which can be placed in front of the
lens

 Filters can affect contrast, sharpness, color, and light intensity, either individually, or in various
combinations.

 The negative aspects of using filters, though often negligible, include the possibility of loss of
image definition if using dirty or scratched filters

Dr. Ali Javed


Pixel count [6]
55

 Gross Pixel count


 The gross count refers to the total number of pixels on the sensor

 Effective Pixel count


 Effective count tells you how many pixels will be used when taking

video or still photos

 For example, a camera that is 2.1 gross/2.0 effective means that the
CCD is comprised of a total of 2.1 million pixels, but the image it captures is
actually using only 2.0 million pixels to create the photo.

Dr. Ali Javed


Optical vs Digital Zoom [7]
56

 Optical Zoom

 Optical zoom is when the lens actually moves in and out and gets you
closer to the object. An optical zoom is a “real zoom”.

 Digital Zoom

 Digital pictures are made up of tons of tiny dots called pixels. A


digital zoom just takes those small pixels and enlarges them internally.

Dr. Ali Javed


Processing Systems
57

 PC based
 General purpose PCs
 Servers
 Industrial PCs

Dr. Ali Javed


Processing Systems
58

 Embedded System based


 DSP processor based
 FPGA based
 System on chip (SoC)

Dr. Ali Javed


Frame Grabber
59

 A component of a computer vision system, in which video frames are captured in digital form and
then displayed, stored or transmitted in raw or compressed digital form.

 Frame Grabber can be Analog as well as Digital

 Early frame grabbers had only enough memory to acquire (i.e., "grab") and store a single
digitized video frame

 Modern frame grabbers are typically able to store multiple frames and compress the frames in
real time using algorithms such as MPEG2 & JPEG

 Frame Grabber Types

 Active Frame Grabber

 Frame grabbers that perform compression on the video frames are referred to as Active Frame Grabbers.

 Passive Frame Grabber

 Frame grabbers that simply capture the raw video data are referred to as Passive Frame Grabbers.

Dr. Ali Javed


References
60

1. DIP by Gonzalez and Woods


2. http://en.wikipedia.org/wiki/Bartlane_cable_picture_transmission_system
3. http://www.ikegami.com/cb/products/pdf/tech/lensmount.pdf
4. http://www.securityideas.com/corcsmount.html
5. http://compreviews.about.com/od/multimedia/a/CRTvsLCD.htm
6. http://camcorders.about.com/od/camcorders101/a/cmos_vs_ccd.htm
7. http://camcorders.about.com/od/camcorder101/a/optialvsdigital.htm
8. https://en.wikipedia.org/wiki/Shot_transition_detection
9. https://en.wikipedia.org/wiki/Dissolve_(filmmaking)
10. https://en.wikipedia.org/wiki/Wipe_(transition)

Dr. Ali Javed


For any query Feel Free to ask
61

Dr. Ali Javed