Dip unit 5 ppt
Dip unit 5 ppt
MISSION:
• M1: To impart outcome based education for emerging technologies in the
field of computer science and engineering.
• M2: To provide opportunities for interaction between academia and
industry.
• M3: To provide platform for lifelong learning by accepting the change in
technologies
• M4: To develop aptitude of fulfilling social responsibilities
Course Outcomes
• Understand the fundamental aspects of image processing
• Apply the mathematical foundations of coloring and image
enhancement in spatial and frequency domains
• Compare and Implement filters for various types of noise.
• Evaluate various coding algorithms used in image processing and
compression
What are the performance metrics for evaluating
image compression
Compression Ratio (CR)
•Formula: CR = Original Size / Compressed Size
•Indicates how much the image has been compressed. Higher is better for
storage/bandwidth.
Bitrate (Bits Per Pixel - bpp)
•Number of bits used per pixel after compression.
•Lower bitrate with high quality is desirable
Entropy
•Measures the average amount of information per pixel.
•Lower entropy after compression suggests effective redundancy removal.
Redundancy
Image Segmentation
Image Segmentation
Image segmentation divides an image into regions that are connected and
have some similarity within the region and some difference between
adjacent regions.
Thegoal is usually to find individual objects inan image.
For the most part there are fundamentally two kinds of approaches to
segmentation: discontinuity andsimilarity.
Discontinuity: Approach is to partition image basedon abrupt changesin intensities(edges).
Similarity: Approach is to partition the image based on similar regions according to
predefined criteria. Suchasthresholding, region growing, region splitting & merging.
How to achieve segmentation?
Segmentation methods:
1. Global approaches such as thresholding
2. Edge-based segmentation
3. Region-based segmentation
Detection of Discontinuities
There are 3 basic types of discontinuities: points, lines and edges.
The detection is based on convoluting the image with a spatial mask.
A general 3x3 mask
w1,1 w1,0 w1,1
w
0,1 w0,0 w0,1
w1,1 w1,0 w1,1
The response of the mask at any point (x,y) in the
1 1
image is R x, y p(x i, y j) w(i, j)
i 1 j1
In digital images, discontinuities occur where there's an abrupt change in pixel intensity.
These can be:
1 1 1
1 8 1
1 1 1
The idea is that the gray level of an isolated point will be quite different from the
gray level of its neighbors.
If, at a certain point in the image, |Ri|>|Rj| for all j i , that point is said to be more likely
associated with a line in the direction of mask i.
Line Detection masks:
-1 -1 -1 2 -1 -1
2 2 2 -1 2 -1
-1 -1 -1 -1 -1 2
Horizontal + 45°
-1 2 -1 -1 -1 2
-1 2 -1 -1 2 -1
-1 2 -1 2 -1 -1
Vertical - 45°
Line Detection masks:
Edge detection
It locates sharp changes in the intensity function.
Edges are pixels where brightness changes abruptly.
A change of the image function can be described by a gradient that points in the
direction of the largest growth of the image function.
An edge is a property attached to an individual pixel and is calculated from the
image function behavior in a neighborhood of the pixel.
Magnitude of the first derivative detects the presence of the edge.
Sign of the second derivative determines whether the edge pixel lies on the dark
sign or light side.
Edge detection
Edge detection
Edge detection
Detection of Discontinuities
• Gradient Operators
First-order derivatives:
•
– The gradient of an image f(x,y) at location (x,y)is defined as the
vector:
G x f
x
f f
G y y
– The magnitude of this vector: f mag(f) G 2 G 2
x y
1
2
Gx
– The direction of this vector: (x, y) tan
1
G
y
– It points in the direction of the greatest rate of change of f at
location (x,y)
Detection of Discontinuities
• Gradient Operators
Detection of Discontinuities
• Gradient Operators
Prewitt operators
Sobel operators
Detection of Discontinuities
• Gradient Operators
Detection of Discontinuities Gradient
Operators: Example
Detection of Discontinuities Gradient
Operators: Example
Detection of Discontinuities
Gradient Operators
Second Order Derivative
The Laplacian of a 2D function f(x,y) is a 2nd-order derivative defined as
2f 2f
f (x', y' )
2
x 2
y 2
The Laplacianhas the same properties in all directions and is therefore invariant to
rotation in the image.
It can also be implemented in digital form in various ways.
For a 3x3 region, the mask is given as
1 if f (x,y) T
g(x, y)
0 f f (x, y) T
When T is a constant applicable over an entire image, then the
above process is called as Global thresholding.
Thresholding
When the value of T changes over an image
Then that process is referred as Variable thresholding.
Sometimes it is also termed as local or regional thresholding.
Where, the value of T at any point (x,y) in an image depends on
properties of a neighborhood of (x,y).
If T depends on the spatial coordinates (x,y) themselves, then
variable thresholding is often referred to as dynamic or adaptive
thresholding.
Thresholding
Multilevel Thresholding
It is also possible to extract objects that have a specific intensity
range using multiple thresholds.
image with dark background
and two light objects
– to background if f(x,y) T1
a if f (x, y) T2
g(x, y) b if T1 f (x, y) T2
c if f (x, y) T1
Thresholding
Thresholding
Role of Noise in Image Thresholding
Basic Global thresholding
Based on visual inspection of histogram
1. Select an initial estimate for T.
2. Segment the image using T. This will produce two groups of pixels:
G1 consisting of all pixels with gray level values > T and G2
consisting of pixels with gray level values T
3. Compute the average gray level values 1 and 2 for the pixels in
regions G1 and G2
4. Compute a new threshold value
5. T = 0.5 (1 + 2)
6. Repeat steps 2 through 4 until the difference between the values of T in
successive iterations is smaller than a predefined parameter ΔT.
Basic Global thresholding
• The major problem with this algorithm is that it does not work for vertical
lines, as they have a slope of infinity
• Convert line into polar coordinates ρ = x cosӨ + ysinӨ, where Ө is the angle
between the line and x-axis, and ρ is the diameter
Example of Hough Transform
Q. Using hough transform, show that the points (1,1), (2,2), (3,3) are collinear . Find
the equation of line.
Sol: Note: Three or more points that lie on the same line are collinear points
The equation of line is y=mx+c , where m=slope and c=intercept
To perform hough transform, we need to convert line from (x,y) plane to (m,c) plane.
The equation of line in (m,c) plane is
c=-mx+y…….(eq.1)
Now
1. For (x,y)= (1,1) ; c=-m+1…..(eq.2)
Now we will consider two conditions i.e if c=0, in eq.1 means 0=-m+1 i.e m=1
if m=0 in eq.2 then c=1
(m,c)=(1,3)
So , by seeing this diagram we have to see the point at
which all these 3 lines meet at same point.
So this point is m=1 and c=0
i.e (m,c)= (1,0)