0% found this document useful (0 votes)
69 views

DIP UNIT 3 (Segment, Compress)

Image segmentation involves partitioning an image into meaningful regions or objects. The main techniques are region-based segmentation which groups similar pixels, edge-based segmentation which detects discontinuities in pixel intensities, and thresholding which separates objects from backgrounds based on intensity values. Image compression reduces the size of image files by removing redundant data. Lossy compression achieves higher compression ratios but introduces errors, while lossless compression preserves image quality. Common lossy compression methods are run length coding which encodes repeated pixel values, and Huffman coding which assigns shorter codes to more common pixel values.

Uploaded by

Shubham Dhundale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views

DIP UNIT 3 (Segment, Compress)

Image segmentation involves partitioning an image into meaningful regions or objects. The main techniques are region-based segmentation which groups similar pixels, edge-based segmentation which detects discontinuities in pixel intensities, and thresholding which separates objects from backgrounds based on intensity values. Image compression reduces the size of image files by removing redundant data. Lossy compression achieves higher compression ratios but introduces errors, while lossless compression preserves image quality. Common lossy compression methods are run length coding which encodes repeated pixel values, and Huffman coding which assigns shorter codes to more common pixel values.

Uploaded by

Shubham Dhundale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

UNIT 3 CH 1, CH 2

Image Segmentation,
Image Compression
Image Segmentation
• It is a process of partitioning the image into
homogeneous pixels based on some criteria.

• Different groups must not intersect with each


other, and adjacent groups must be
heterogeneous.
IMAGE-SEGMENTATION TECHNIQUES
Image Segmentation

Local Segmentation Global Segmentation

Region Approach Edge Approach

Boundary Approach
Region Approach
• Regions in an image are a group of
connected pixels with similar properties.

• In the region approach, each pixel is


assigned to a particular object or region.
Region Growing

• Here each neighbouring pixel is examined and


added to a region class if no edges are detected.

• If adjacent regions are found, both regions are


merged, weak edges are dissolved and strong
edges are left intact.
• Algorithm starts with a single pixel as a seed,
using homogeneity criterion a region is grown,
and removed from the process.

• Then another pixel is chosen as a seed and


algorithm continuous until all pixels have been
allocated to a segment.
Region Splitting and Merging

• As the name suggests it is a two step process.

• It begins with a whole image and divides it up


such that the segregated parts are more
homogenous than the whole.

• Merge any adjacent regions that are similar


enough.
• Algorithm:
1. Start with the whole image.
2. If the variance is too large, break it into
quadrants.
3. Merge any adjacent regions that are similar
enough.
4. Repeat steps (2) and (3) iteratively until no more
splitting or merging occurs.
Splitting Merging

Splitting Merging
IMAGE SEGMENTATION BASED ON
THRESHOLDING
• Thresholding techniques produce segments
having pixels with similar intensities.

• In Thresholding we establish boundaries in


images that contain solid objects resting on a
contrasting background.
Global Thresholding

• …. θ is threshold value

• If due to poor illumination image have different


areas with different intensities, Variable
Thresolding i.e form of local thresholding can be
used.
Adaptive Thresholding

• Global theresholding works when image


foreground have approximately uniform grey
level, similarly background also have uniform grey
level but unequal to foreground gray level.

• But if background grey levels are not constant or


contrast is varying within the image. Then it is
better use adaptive threshold grey levels as per
image area.
Histogram-Based Threshold Selection
• If we calculate Histogram for an image containing
object on a contrasting grey level background, it
will have 2 peaks, representing large number of
pixels inside and outside of the object. The dip
between the two peaks represents relatively low
number of pixels around the edge of the object.
This dip is commonly used for selecting threshold
grey level.
• If the objects in the image are not large or the
image is noisy, histogram may not show any
confident dip.
EDGE-BASED SEGMENTATION
• Points in an image where brightness changes
abruptly are called edges or edge points.
• Step Edge: intensity abruptly changes.

• Line Edge: when segment is very narrow,


it has two edges in close proximity.

• Ramp Edge: smoother transition between


segments
• Roof Edge: Two nearby ramp edges

• 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.

Does not give


averaging effect
• Second-order Derivative Method
• Differentiating the first derivative gives the
second derivative. The Laplacian.

• and

But this is not used in


edge detection as it
is very sensitive to
the noise and it gives
double edges.
CH 2
IMAGE
COMPRESSION
Need for Compression
• Due to the development in Internet,
teleconferencing, multimedia and high-definition
multimedia technologies storage and transmission
of this data becomes an issue.
• E.g during this current teams call minimum of 10
times a second the screen is captured and
transmitted to al participants. So data
requirements per transmission is approx. 30 Mbs
per second.
• we can understand the requirement of image
compression.
REDUNDANCY IN IMAGES

• Images have redundant information.

• Compression is achieved through redundancy and


irrelevancy reduction.
Redundancy is broadly
classified as, Types of Redundancy

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

• Spatial redundancy implies that there is a


relationship between neighboring pixels in an
image.
• Instead of representing each pixel in an image
independently, pixel value can be predicted from
its neighbors.
Temporal Redundancy

• Temporal redundancy is the statistical correlation


between pixels from successive frames in a video
sequence.

• The temporal redundancy is also called interframe


redundancy.
Psychovisual Redundancy

• In the Human Visual System, visual information is


not perceived equally.
• Some information may be more important than
other information.
• If less data is used to represent less important
visual information, perception will not be
affected.
IMAGE-COMPRESSION SCHEMES
• Lossless Compression or Reversible Compression

• Image after compression and decompression is


identical to the original image

• This only achieves modest compression rate.

• Preferred in the case of medical image


compression.
• Lossy Compression or Irreversible Compression

• The reconstructed image contains degradations


with respect to the original image.

• Higher compression ratio can be achieved

• Term ‘visually lossless’ is often used to


characterize lossy compression schemes that
result in no visible degradation.

• Preferred in the case of multimedia applications


RUN-LENGTH CODING
• It is effective when long sequences of the same
symbol occur.
• It exploits the spatial redundancy
• Run - repetition of a symbol
• Run-length - number of repeated symbols
• It maps a sequence of numbers into a sequence of
symbol pairs (run, value).
• It is used in Windows bitmap file format.
• There are 2 types (i) 1D run-length coding, and (ii)
2D run-length coding
1D Run-length Coding
• In these scheme each scan line is coded
individually.
• Each scan line is alternating sequence of runs of
1’s and 0’s.
• Consider following binary image,
• in RLC every run is converted to 2 values,
(run length, actual symbol)
• In the given example, the run-length coding for
the fourth row of the input image is,
4, 0, 10, 1, 4, 0.

• 2D Run-length Coding
• utilising correlation between pixels in neighboring
scan lines to achieve higher coding efficiency.
HUFFMAN CODING

• The most popular technique for removing coding


redundancy.

• Huffman coding assigns a binary code to each


intensity value.

• Shorter codes are assigned to intensities with


higher probability and longer codes will do for
intensities with lower probability.
• In the first step we combine the lowest probability
symbols into a single symbol that replaces them in
next source reduction.
• In the second step we code each reduced source,
starting with the smallest source and working
back to the original source.
• Obtain the Huffman code for the word
‘COMMITTEE’

p(C) 1/9 0.1


p(O) 1/9 0.1
p(M) 2/9 0.2
p(I) 1/9 0.1
p(T) 2/9 0.2
p(E) 2/9 0.2
• Step 1
• Step 2

You might also like