Professional Documents
Culture Documents
UNIT - 1
TYBSC Sem – VI
Lecturer - Dhawal S. Bhangale
Wt is DIP ?
• Processing of image in digital form by digital
computer.
Why to process ?
• Improvement of pictorial info for human
perception.
• For autonomous machine application like quality
control, assembly automation.
• Efficient storage & transmission e.g. reduce disk
space and transmission time through low
bandwidth channel.
A. Human Perception
• Noise filtration.
• Improve certain characteristics of an image
like
– Contrast enhancement
– DE blurring – blurriness may appear due to
hand shake or moving platform or wrong
camera settings.
• Remote sensing – images taken from
satellite.
Filtering
Image Enhancement
Colored Image Enhancement
De Blurring
Medical Imaging
Medical Imaging
Medical Imaging
Remote Sensing
Remote Sensing
Remote Sensing
Machine vision Application
• Here we are not much interested in improving
visual quality of an image but to process image to
extract information or features which can be used
in applications like;
• Industrial machine vision, inspection.
• Automated target detection and tracking.
• Finger print detection.
• Arial & satellite images for weather predication
and forcasting.
Automated inspection
Automated inspection
Video Sequence Processing
• Video sequence is different image frames
displayed one after another.
• Used for applications like;
• Detection of moving parts (targets) for security
surveillance.
• Find trajectory of moving objects.
• Monitoring boundaries of moving objects in
medical applications.
Video Sequence Processing
Image compression
• For storing or transmitting.
• Image usually contains lot of redundancies that
can be exploited to achieve compassion.
• 3 types of redundancies:
– Pixel Redundancy
– Coding Redundancy
– Psychovisual Redundancy
• For compression we try to remove redundancies
retaining only information stored in the image.
Image Compression
History
• In 1920 DIP used to transmit digital image from
London and New York. Only 2 shades were used.
• In 1921 photographic printing improved quality. 5
shades were used.
• By 1929 it reached up to 5 shades.
• In 1964 for printing moon pictures sent by
satellite we improved the technology; here
actually modern DIP started.
Representing Digital Image
• Image is 2D light intensity function f(x,y). At
any point (x,y), value represent intensity at
that point.
• f(x,y) = r(x,y) * i(x,y)
• r(x,y) – reflectivity of the surface at the
corresponding point of image.
• i(x,y) – intensity on incident light.
• Representing analog image in a
computer is impossible.
• Ideally image have infinite points to
represent the info.
• The value of any point in image may
also have amplitude from 0 to infinity.
• Storing such infinite sized image we
store some sample values from image.
• To locate points to be stored we use discretization
process.
• To store amplitude value we quantize the ideally
infinite amplitude values to a limited range.
• Image can be represented as a matrix.
0 0 0 0 0 0 0
0 0 0 1 1 0 0
0 0 1 1 1 0 0
0 0 1 1 1 0 0
0 1 1 1 1 1 0
0 1 1 0 1 1 0
0 0 0 0 0 0 0
Neighbours of a Pixel
• Two types of neighbours a pixel P can have
• 4 Neighbours 8 Neighbours
X X X X
X P X X P X
X X X X
Resolution
• Resolution gives the degree of distinguishable
details.
Spatial Resolution Gray – Level Resolution
Smallest visible detail in image Smallest visible change in gray
level
Depends on number of pixels Depends on number of gray
levels
Depends upon sampling Gray levels are generally an
integer power of 2 e.g. 8, 16, 64,
256, etc
• If we use insufficient no of gray levels in smooth
areas of image, it causes “False Contouring”.
False Contouring
1, n1 = n 2 = 0
• x(n1,n2) = δ(n1,n2) =
0, otherwise
• Line Impulse
– Vertical Line Impulse
• x(n1,n2) = δ(n1)
• i.e. x(n1,n2) will have
value 1 when n1 = 0
• Line Impulse
– Horizontal Line Impulse
• x(n1,n2) = δ(n2)
• i.e. x(n1,n2) will have
value 1 when n2 = 0
• Line Impulse
– Diagonal Line Impulse
• Diagonal impulse has value 1 only at the diagonal points.
• x(n1,n2) = e jw1+jw2
𝑤1 𝑤2
• Because and are rational
2𝜋 2𝜋
• Scaling property,
• If input is x1(n1,n2) and output is y1(n1,n2)
• Then if input is a1x1(n1,n2), output is
a1y1(n1,n2)
• Additive property,
• Shift-Variant Vs. Shift-Invariant Systems
• Shift-Invariant system’s input-output
characteristics do not change with time.
• Shift invariance is given by,
• For T[x(n1, n2)] = y(n1, n2)
• T[x(n1-m1, n2-m2)] = y(n1-m1, n2-m2)
• Static Vs. Dynamic System
• A system is static or memoryless if its output at
any instant depends at most on the input sample
but not on the past and future samples of the
input.
• In any other case, the system is said to be
dynamic or to have memory.
• i.e. y(n) = x(n) is static
• But
• y1(n) = x1(n) + x1(n-1) + x1(n+2) is dynamic
2D Digital Filters
• Filters are used for many image processing
applications like image enhancement, image
deblurring, target matching, etc.
𝑎𝑝𝑦 𝑛1 − 𝑝, 𝑛2 − 𝑝 + 𝑏𝑞𝑥(𝑛1 − 𝑞, 𝑛2 − 𝑞)
𝑝=1 𝑞=0
(past output) (present and past input)
2D CONVOLUTION
• Commutative Property
– x (n1, n2) ∗ y (n1, n2) = y (n1, n2) ∗ x (n1, n2)
• Associative Property
– (x (n1, n2) ∗ y (n1, n2)) ∗ z (n1, n2)
= x (n1, n2) ∗ ( y (n1, n2) ∗ z (n1, n2))
• Distributive Property
– x (n1, n2) ∗ ( y (n1, n2) + z (n1, n2))
= x (n1, n2) ∗ y (n1, n2) + x (n1, n2) ∗ z (n1, n2)
TYBSC Sem – VI
Lecturer - Dhawal S. Bhangale
IMAGE ENHANCEMENT IN
SPATIAL DOMAIN
Spatial domain
• Means working with pixel values, working
directly with the raw data.
• The modified image
can be expressed as,
g( x , y ) = T [ f( x , y ) ]
where T is the
Transformation applied
• Spatial domain transformations are carried out in
2 ways:
Point processing, Neighborhood processing.
• Point Processing:- Work with single pixel.
T is 1 X 1 operator.
• Identity transform; in this
the original image
don’t change. Modified Gray
Level
(output pixel
value) s
• Contrast Stretching:-
• We may get low contrast images due to poor
illumination or wrong setting of lens aperture.
Contrast stretching is Making dark portion darker
and bright portion brighter.
• It increases the dynamic range of modified image.
• Formula for contrast stretching is;
Original
HIGH
FREQUENCY
LOW
FREQUENCY
Step1: Step2:
Step3: Step4:
median filter
• Highpass Filtering
• Eliminates low frequency regions and enhance
high frequency region. Effect of applying this filter
on image may result in removal of background
and enhancement of fine details and edges.
• So it is also used to sharpen images.
• Consider this image with a sharp edge. If we
apply above mask on this image output will be;
•
• High boosted image
• Unsharp Masking: We can also get a sharp
image by subtracting a blurred version of image
from original image. Used for edge enhancement.
• Steps are given below:
– Blur filter the image
– Subtract blurred image from original image
– Multiply the result with some weight
– Add result obtained to the original image
• f’(m,n) = f(m,n) + [f(m,n) – ̿f (m,n)]
– f(m,n) – original image
– ̿f (m,n) – blurred version
– f‘(m,n) – sharped result
• Zooming
• Can be done by two methods;
– Replication, Interpolation
• Replication:-
• Simply replicating each row and column.
• This is very easy method of zooming, but if the
image is zoomed to larger sizes clusters of gray
levels are formed, making the image look patchy.
• Original image Zoomed image
• Linear Interpolation:-
• Average of two adjacent pixels along the row is
taken and placed between those pixels, same
operation is performed along the columns.
• Interpolation along rows;
v-row(m,n) = u(m,n); 0<=m<=M-1, 0<=n<=N-1
v-row(m,n+1) = ½{u(m,n) + u(m,n+1)}
0<=m<=M-1, 0<=n<=N-1
Interpolation along columns;
v-col(m,n) = u(m,n); 0<=m<=M-1, 0<=n<=N-1
v-col(m,n+1) = ½{u(m,n) + u(m+1,n)}
0<=m<=M-1, 0<=n<=N-1
Histogram
• It is a plot of the number of occurrences of gray
levels in the image against the gray-level values.
• provides more insight about image contrast and
brightness.
– The histogram of a dark image will be clustered
towards the lower gray level.
– The histogram of a bright image will be clustered
towards higher gray level.
– For a low-contrast image, the histogram will not be
spread equally, that is, the histogram will be narrow.
– For a high-contrast image, the histogram will have an
equal spread in the gray level.
• Histogram Linear Stretching
• We do not alter the basic shape of the histogram,
but we spread it to cover the entire range.
• New gray level to assign pixels to;
(s-max – s-min)
s = T(r) = (r – r-min) + s-min
(r-max – r-min)
• Where,
• s-max max gray level of output image
• s-min min gray level of output image
• r-max max gray level of input image
• r-min min gray level of input image
Histogram Equalization
• A perfect image is one which has equal number of
pixels in all its gray levels.
• Equalization is a process that attempts to spread
out the gray levels in an image so that they are
evenly distributed across their range.
l
• Ideal filter is not realizable using
physical components, but using
computer programs only.
• Ringing effect in low pass filtering:-
• With D0 = 10
Homomorphic Filtering
• An image f(n1,n2) is characterized by two
components;
– The amount of light incident on scene/object
(illumination) :- i(n1,n2)
– Amount of light reflected by the object
(reflection):- r(n1,n2)
• Image f(n1,n2) is formed by;
f(n1,n2) = i(n1,n2) . r(n1,n2)
where 0 < i(n1,n2) < infinity AND
0 < r(n1,n2) < 1; 0 indicates
total absorption and 1 indicates total reflection.
B B B
W B W
B W W
W W W
W W W
W B B
B W B
B B B
• NOT, XOR operation.
W B
B W
W W W
W B B
B W B
B B W
• Logical Opearations
STANDARD BINARY
MORPHOLOGICAL OPERATIONS
• Dilation
• The dilation operation is defined as,
Boundary Approach
Region Approach
• Regions in an image are a group of
connected pixels with similar properties.
Splitting Merging
IMAGE SEGMENTATION BASED ON
THRESHOLDING
• Thresholding techniques produce segments
having pixels with similar intensities.
• …. θ is threshold value
• Causes of Edges:
– shadows, texture, geometry, etc.
– discontinuities in the image intensity due to changes
in the image structure.
– Edge points are boundaries of objects and
background.
Edge Detection Using First-order and
Second-order Derivatives
Consider two regions having transitions in intensity
1.from dark to bright to dark
2.from bright to dark to bright
• The first derivative values are shown;
• 1st derivative is positive at the leading edge means
transition from dark to bright and vise versa
• Second derivative is positive on the darker side of
the edge and negative on the brighter side.
• First order derivative can be calculated using the
Gradient Operator. Where as second order derivative
using the Laplacian.
• The gradient of image f(x,y) at location (x,y) is defined
by the vector,
𝜕𝑓
𝐺𝑥 𝜕𝑥
• 𝛻𝑓 = 𝐺𝑦
= 𝜕𝑓 ∴ 𝜵𝒇 ≈ 𝑮𝒙 + 𝑮𝒚
𝜕𝑦
𝜕𝑓
• = 𝐺𝑥 = 𝑓 𝑥 + 1, 𝑦 − 𝑓(𝑥, 𝑦)
𝜕𝑥
𝜕𝑓
• = 𝐺𝑦 = 𝑓 𝑥, 𝑦 + 1 − 𝑓(𝑥, 𝑦)
𝜕𝑦
Gives averaging effect
So noise is reduced.
• and
Statistical Psychovisual
Interpixel Coding
Spatial Temporal
Statistical Redundancy
• Interpixel Redundancy
• If in an image neighbouring pixel values are
related to each other, i.e. neighboring pixels are
not statistically independent.
• Coding redundancy
• In an image the information is represented in the
form of codes. Choosing efficient codes may
reduce image size.
Spatial Redundancy
• 2D Run-length Coding
• utilising correlation between pixels in neighboring
scan lines to achieve higher coding efficiency.
HUFFMAN CODING