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

Lecture 6

The document discusses image segmentation and outlines some common techniques used for segmentation, including edge detection, thresholding, and derivatives. It begins by defining segmentation as partitioning pixels into groups that correlate with objects in an image. Several edge detection filters and methods are described, including using derivatives to find discontinuities and the Laplacian of Gaussian filter. Thresholding techniques are also covered, such as global thresholding based on image histograms as well as challenges with single value thresholding.

Uploaded by

Behind The Side
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Lecture 6

The document discusses image segmentation and outlines some common techniques used for segmentation, including edge detection, thresholding, and derivatives. It begins by defining segmentation as partitioning pixels into groups that correlate with objects in an image. Several edge detection filters and methods are described, including using derivatives to find discontinuities and the Laplacian of Gaussian filter. Thresholding techniques are also covered, such as global thresholding based on image histograms as well as challenges with single value thresholding.

Uploaded by

Behind The Side
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

The Segmentation Problem

Computer Graphics and Image Processing


Lecture 6

Muhammad Usman Ghani Khan

Department of Computer Science & Engineering


UET, Lahore

Autumn Semester

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Outline

1 The Segmentation Problem

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Agenda

Today Discussion
So far we have been considering image processing
techniques used to transform images for human
interpretation
Today we will begin looking at automated image analysis
by examining the thorny issue of image segmentation:
The segmentation problem
Finding points, lines and edges

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

The Segmentation Problem

+ Segmentation attempts to partition the pixels of an image


into groups that strongly correlate with the objects in an
image.
+ Typically the first step in any automated computer vision
application

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Segmentation Examples

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Detection Of Discontinuities

There are three basic types of grey level discontinuities that we


tend to look for in digital images:
1 Points
2 Lines
3 Edges
We typically find discontinuities using masks and correlation

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Point Detection
Point detection can be achieved simply using the mask below:

Points are detected at those pixels in theandsubsequent


Computer Graphics Image Processing - Lecture 6
The Segmentation Problem

Point Detection

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Line Detection

The next level of complexity is to try to detect lines

The masks given above extract lines that are one pixel
thick and running in a particular direction

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Line Detection

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Edge Detection

An edge is a set of connected pixels that lie on the boundary


between two regions

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Edges & Derivatives

We have already spoken about how


derivatives are used to find
discontinuities
1st derivative tells us where an
edge is
2nd derivative can be used to
show edge direction

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Derivatives & Noise

Derivative based edge detectors are extremely sensitive to


noise

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Common Edge Detectors

Given a 3 ∗ 3 region of an image the following edge detection


filters can be used

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Edge Detection Example

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Edge Detection Example

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Edge Detection Example

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Edge Detection Example

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Edge Detection Problems

Often, problems arise in edge detection in that there are is


too much detail
For example, the brickwork in the previous example
One way to overcome this is to smooth images prior to
edge detection

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Edge Detection Example With Smoothing

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Laplacian Edge Detection

We encountered the 2nd-order derivative based Laplacian filter


already

The Laplacian is typically not used by itself as it is too


sensitive to noise
Usually hen used for edge detection the Laplacian is
combined with a smoothing Gaussian filter

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Laplacian Of Gaussian

The Laplacian of Gaussian (or Mexican hat) filter uses the


Gaussian for noise removal and the Laplacian for edge
detection

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Laplacian Of Gaussian - Example

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Summary

In this section we have begun looking at segmentation,


and in particular edge detection
Edge detection is massively important as it is in many
cases the first step to object recognition
Next section is about thresholding techniques.

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Thresholding

Thresholding is usually the first step in any segmentation


approach
We have talked about simple single value thresholding
already
Single value thresholding can be given mathematically as
follows:

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Thresholding Example

Imagine a poker playing robot that needs to visually


interpret the cards in its hand

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Thresholding Example: Be careful

If you get the threshold wrong the results can be disastrous

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Basic Global Thresholding

Based on the histogram of an image


Partition the image histogram using a single global
threshold
The success of this technique very strongly depends on
how well the histogram can be partitioned

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Basic Global Thresholding Algortithm


The basic global threshold T is calculated as follows:
1 Select an initial estimate for T (typically the average grey
level in the image)
2 Segment the image using T to produce two groups of
pixels: G1 consisting of pixels with grey levels > T and G2
consisting pixels with grey levels ≤ T
3 Compute the average grey levels of pixels in G1 to give µ1
and G2 to give µ2
µ1 + µ2
T = (1)
2
4 Repeat steps 2 − 4 until the difference in T in successive
iterations is less than a predefined limit T∞
This algorithm works very well for finding thresholds when the
histogram is suitable
Computer Graphics and Image Processing - Lecture 6
The Segmentation Problem

Thresholding Example 1

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Thresholding Example 2

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Problems With Single Value Thresholding

Single value thresholding only works for bimodal


histograms
Images with other kinds of histograms need more than a
single threshold

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Problems With Single Value Thresholding

Let’s say we want to isolate the contents of the bottles


Think about what the histogram for this image would look
like
What would happen if we used a single threshold value?

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Single Value Thresholding and Illumination

Uneven illumination can really upset a single valued


thresholding scheme

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Basic Adaptive Thresholding

An approach to handling situations in which single value


thresholding will not work is to divide an image into sub
images and threshold these individually
Since the threshold for each pixel depends on its location
within an image this technique is said to adaptive

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Basic Adaptive Thresholding Example

The image below shows an example of using adaptive


thresholding with the image shown previously

As can be seen success is mixed


But, we can further subdivide the troublesome sub images
for more success

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Basic Adaptive Thresholding Example

These images show the


troublesome parts of the previous
problem further subdivided
After this sub division successful
thresholding can be achieved

Computer Graphics and Image Processing - Lecture 6


The Segmentation Problem

Summary

In this section we have begun looking at segmentation,


and in particular thresholding
We saw the basic global thresholding algorithm and its
shortcomings
We also saw a simple way to overcome some of these
limitations using adaptive thresholding

Computer Graphics and Image Processing - Lecture 6

You might also like