You are on page 1of 27

Escuela Profesional de

Ciencia de la Computación

ICC Fase 1

Computer graphics
Thresholding

MSc. Vicente Machaca Arceda

Universidad Nacional de San Agustín de Arequipa

April 28, 2020

MSc. Vicente Machaca Arceda (UNSA) 1704146 1 / 26


Overview

1 Introduction
Objectives
Sample application

2 Point operators
Definition
Thresholding

MSc. Vicente Machaca Arceda (UNSA) 1704146 2 / 26


Introduction

Table of Contents

1 Introduction
Objectives
Sample application

2 Point operators
Definition
Thresholding

MSc. Vicente Machaca Arceda (UNSA) 1704146 3 / 26


Introduction Objectives

Objectives

Understand the difference between point, local and


operators in image processing.

MSc. Vicente Machaca Arceda (UNSA) 1704146 4 / 26


Introduction Objectives

Objectives

Understand the difference between point, local and


operators in image processing.
Learn threshold method.

MSc. Vicente Machaca Arceda (UNSA) 1704146 4 / 26


Introduction Sample application

Sample application

Figure: Sample application in pattern recognition

MSc. Vicente Machaca Arceda (UNSA) 1704146 5 / 26


Introduction Sample application

Sample application

Figure: Sample application in pattern recognition

MSc. Vicente Machaca Arceda (UNSA) 1704146 6 / 26


Point operators

Table of Contents

1 Introduction
Objectives
Sample application

2 Point operators
Definition
Thresholding

MSc. Vicente Machaca Arceda (UNSA) 1704146 7 / 26


Point operators Definition

Point operators
Example

Figure: Point operator.

MSc. Vicente Machaca Arceda (UNSA) 1704146 8 / 26


Point operators Definition

Point operators
Formal definition

Point operator
O{f [x, y ]} = g[x 0 , y 0 ]

MSc. Vicente Machaca Arceda (UNSA) 1704146 9 / 26


Point operators Definition

Point operators
Examples

Thresholding
Contrast Stretching
Histogram Equalization
Logarithm Operator
Exponential/Raise to Power Operator

MSc. Vicente Machaca Arceda (UNSA) 1704146 10 / 26


Point operators Thresholding

Thresholding

Figure: The input for a thresholding operation is typically a grayscale or


color image. In the simplest implementation, the output is a binary
image representing the segmentation. Black pixels correspond to
background and white pixels correspond to foreground (or vice versa).

MSc. Vicente Machaca Arceda (UNSA) 1704146 11 / 26


Point operators Thresholding

Thresholding

(
0, if f [x, y ] < threshold
g[x, y ] =
1, otherwise

MSc. Vicente Machaca Arceda (UNSA) 1704146 12 / 26


Point operators Thresholding

Thresholding
Example

What threshold should we choose?

MSc. Vicente Machaca Arceda (UNSA) 1704146 13 / 26


Point operators Thresholding

Histograms
Review

Figure: Histogram example.

MSc. Vicente Machaca Arceda (UNSA) 1704146 14 / 26


Point operators Thresholding

Thresholding
Example

In this image we are going to


analyze what is the best
threshold.

Figure: A simple grayscale image.

MSc. Vicente Machaca Arceda (UNSA) 1704146 15 / 26


Point operators Thresholding

Thresholding
Example

Figure: Histogram.

Figure: A simple grayscale image.

MSc. Vicente Machaca Arceda (UNSA) 1704146 16 / 26


Point operators Thresholding

Thresholding
Example

A good threshold is 120.

Figure: Histogram.
Figure: A simple grayscale image.

MSc. Vicente Machaca Arceda (UNSA) 1704146 17 / 26


Point operators Thresholding

Thresholding
Example

(
0, if f [x, y ] < 120
g[x, y ] =
1, otherwise

f [x, y ] g[x, y ]

Figure: A simple grayscale image. Figure: A simple binary image.

MSc. Vicente Machaca Arceda (UNSA) 1704146 18 / 26


Point operators Thresholding

Thresholding
Applications

Thresholding is also used to filter the output of or input to other


operators. For instance, in the former case, an edge detector
like Sobel.

Figure: Uses of thresholding.

MSc. Vicente Machaca Arceda (UNSA) 1704146 19 / 26


Point operators Thresholding

Thresholding
Applications

Thresholding can be used as preprocessing to extract an


interesting subset of image structures which will then be passed
along to another operator in an image processing chain.

Nervous cells (the large


gray blobs, with darker
circular nuclei in the
middle).
Glia cells (the isolated,
small, black circles).

Figure: A slice of brain tissue.

MSc. Vicente Machaca Arceda (UNSA) 1704146 20 / 26


Point operators Thresholding

Thresholding
Applications

Thresholding can be used as preprocessing to extract an


interesting subset of image structures which will then be passed
along to another operator in an image processing chain.

Nervous cells (the large


gray blobs, with darker
circular nuclei in the
middle).
Glia cells (the isolated,
small, black circles).

Figure: A slice of brain tissue.

MSc. Vicente Machaca Arceda (UNSA) 1704146 21 / 26


Point operators Thresholding

Thresholding
Applications

Thresholding this image so as to map all pixel values between 0


and 150 in the original image to foreground.

Figure: A slice of brain tissue. Figure: A slice of brain tissue.

MSc. Vicente Machaca Arceda (UNSA) 1704146 22 / 26


Point operators Thresholding

Thresholding
Applications

The resultant image can then be


connected-components-labeled in order to count the total
number of cells in the original image.

Figure: A slice of brain tissue. Figure: A slice of brain tissue.

MSc. Vicente Machaca Arceda (UNSA) 1704146 23 / 26


Point operators Thresholding

Thresholding
Applications

If we wanted to know how many nerve cells there are in the


original image.

Figure: Nerve cell.

MSc. Vicente Machaca Arceda (UNSA) 1704146 24 / 26


Point operators Thresholding

Thresholding
Applications

If we wanted to know how (


many nerve cells there are in 0, if 130 < f [x, y ] < 150
g[x, y ] =
the original image, we 1, otherwise
threshold the image.

Figure: Nerve cell. Figure: Nerve cell binarized.

MSc. Vicente Machaca Arceda (UNSA) 1704146 25 / 26


Point operators Thresholding

Questions?

MSc. Vicente Machaca Arceda (UNSA) 1704146 26 / 26

You might also like