Docsity

Image Processing & Computer vision, Appunti di Fisica Sperimentale

Toggle sidebar
bg1
Image Processing Notes
Images and visual perception
: an image is measure of the reflected (or
transmitted) light used for illuminated the object.
: The Radiometry is the topic that describes
and measures radiation and its interaction with
the matter.
Some basic quantities:
➢ Radiant energy (E): energy carried by the
radiation
➢ Radiant flux (Q): energy per unit time
➢ Radiant exitance (L): radiant flux emitted
by a surface per unit area → dQ/dA
➢ Irradiance (E): radiant flux received by a
surface per unit area → dQ/dA
➢ Radiant intensity: dQ/dw
NB: after the interaction with the matter the
radiation isn’t monochromatic (decomposition in
a prism) → multispectral imaging
: the photometry is the measurement of the
visible light [Candela]
The Human eye
: The Luminosity function is the efficiency of
the human eye for a range of wavelengths. We
have 2 luminosity functions:
➢ Photopic vision: for everyday light; less
efficient
➢ Scotopic vision: for low-light level; more
efficient due to the less of light and
shifted on blue.
: the intensity of a light source with a spectral
power distribution P can be written as:
𝐿=∫ 𝑃(𝜆)𝑉(𝜆)𝑑𝜆
+∞
−∞
Where V is the spectral sensitivity of the human
eye.
the retina is the light sensitive layer at the
back of the eye. We have 2 types of
photoreceptors (=converts light into signal):
➢ Cones: low sensitivity, high light
condition, responsible for colour vision →
photopic vision
➢ Rods: high sensitivity, low light condition,
monochromatic radiation, rods density
increases in the periphery of visual field
(more peripheral vision in the night) →
scotopic vision.
NB: We have 3 types of Cones → responsible of
our colour perception: our brain receives a colour
corresponding to 3 numbers (Young Model)
Human visual system → logarithmic function –
brightness adaptation
NB: the contrast is the change of intensity → the
human eye has some issues sometimes
Colour vision
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12

Anteprima parziale del testo

Scarica Image Processing & Computer vision e più Appunti in PDF di Fisica Sperimentale solo su Docsity!

Image Processing Notes

Images and visual perception

: an image is measure of the reflected (or

transmitted) light used for illuminated the object.

: The Radiometry is the topic that describes

and measures radiation and its interaction with

the matter.

Some basic quantities:

➢ Radiant energy (E) : energy carried by the

radiation

➢ Radiant flux (Q): energy per unit time

➢ Radiant exitance (L): radiant flux emitted

by a surface per unit area → dQ/dA

➢ Irradiance (E ): radiant flux received by a

surface per unit area → dQ/dA

➢ Radiant intensity : dQ/dw

NB: after the interaction with the matter the

radiation isn’t monochromatic (decomposition in

a prism) → multispectral imaging

: the photometry is the measurement of the

visible light [Candela]

The Human eye

: The Luminosity function is the efficiency of

the human eye for a range of wavelengths. We

have 2 luminosity functions:

➢ Photopic vision : for everyday light; less

efficient

➢ Scotopic vision : for low-light level; more

efficient due to the less of light and

shifted on blue.

: the intensity of a light source with a spectral

power distribution P can be written as:

+∞

−∞

Where V is the spectral sensitivity of the human

eye.

the retina is the light sensitive layer at the

back of the eye. We have 2 types of

photoreceptors (=converts light into signal):

➢ Cones : low sensitivity, high light

condition, responsible for colour vision →

photopic vision

➢ Rods : high sensitivity, low light condition,

monochromatic radiation, rods density

increases in the periphery of visual field

(more peripheral vision in the night) →

scotopic vision.

NB: We have 3 types of Cones → responsible of

our colour perception: our brain receives a colour

corresponding to 3 numbers (Young Model)

Human visual system → logarithmic function –

brightness adaptation

NB: the contrast is the change of intensity → the

human eye has some issues sometimes

Colour vision

NB: A monochromatic wave is mapped into a

triplet of signal by the human eye visual system,

as a correspondence of the output of the three

different cones at that wavelength.

: a colour space is a model describing the way

colours can be represented as tuples of numbers,

typically as three values or colour components.

➢ RGB : represented as a cube with corners

of black, 3 primaries, 3 secondaries and

white → issue in blue/green region

➢ CIE : colours are not real, but fraction of

red, blue and green

➢ HSV : the basis quantities are Hue,

saturation and brightness; can be

represented as an hexagonal cone.

➢ CMY : subtractive model.

Digital images introduction

geometry

the geometry is the relation between the

object in the 3D space and its representation into

2D space.

The first camera was the Pinhole camera, which

use a hole to focus the rays onto a wall. The size

of the object depends on the distance from the

hole.

➢ Perspective projection

➢ Orthographic projection →

approximation if the size of the obj is

smaller than the distance

Pinhole camera drawbacks:

➢ Pinhole too small →diffraction

➢ Pinhole too big → blurring

: what define a sharp image is the transition

between 2 intensities.

NB: The contrast defines an edge.

To overcome these problems, we can use lenses.

NB: passing from 3d space into 2d space we lose

information about depth: we can recover it

acquiring multiple images at different angles.

: the FOV is the angle at which the photons

are acquired, in other words is the cone of

viewing directions of the device. It depends on

the focal length f and the effective area of the

device (w,h)

: the magnification factor is the ration

between the dimension of the object in the

image over the dimension of the obj in the scene.

Radiometry

the radiometry is the relation between the

amount of light radiating from a point and the

amount of light impinging on the correspondence

image point.

The amount of light on image plane in p is

2

∙ cos

4

: the amount of light f(x,y) coming from and

object at point (x,y) can be expressed as

Where i(x,y) is the light coming from the source

and r(x,y) is the reflectance of the object (it goes

from 0 to 1) and can be:

➢ Ideal diffuse

➢ Ideal specular

➢ Directional diffuse

IMAGE FORMATION

  • More visibility of low

contrast details

➢ Acquisition and visualization devices

must support high res

Low resolution

➢ Less storage space required

➢ Fast operation:

  • Image acquisition
  • Image processing
  • Image visualization

➢ Images are less affected by statistical

noise: this is because if you increase the

are you increase the photons collected

and increase the statistics.

Digital image representation

: the digital image can be described as a

matrix of number of MxN integer number, each

one ranging from 0 and 2

m

  • 1 (0 and 255 if m=

bit), with M and N depends on the device.

: the lexicographic form is a representation of

the matrix in which every pixel in the image is

listed in one long vector.

With vector form the application of linear

operators on images can be written as matrix

multiplication

𝑔 = [𝐻] ∙ 𝑓

Where g is the digital image and H describes the

acqusition system.

: the image quality represent the overall

appearance of the image and can be:

➢ Subjective: involving human observer

➢ Objective: using the mean squared error

[

𝑖

]

𝑁 2

2

𝑛= 1

2

𝑁

2

𝑛= 1

Where g i

is the ideal image and g the

acquired one

Digital images processing

digital image chain

An image sensor is made by bilions of

photosensitive sigtes which converts linght into

electrical signal.

We have 2 types of devices:

➢ Scintillators detectors: scintillator +

photomultiplier → indirect conversion

➢ Semiconductor detector: semicomductor

  • anode and cathode → direct

conversion

And we can have different arrangements:

➢ Scintillator + photodetector: a lot of

spread of radiation →blurred

➢ Needle scintillator + photodetector:

radiation is guided into needle

➢ Electric field + photodetector: direct

conversion

In the image chain we also need a visualization

device, which converts numbers into visible light.

Visualization devices can create:

➢ Hard copy of the image (printers)

➢ Soft copy (displays)

We can have different image formats:

➢ Raster: describes image as a pattern of

dots or pixels, each pixels contains the

brightness of that points →jpeg, gif, tiff…

➢ Vector: describes images with

mathematical functions which define

curve and lines → pdf, ps… (better for

text images)

➢ Compressed or nor compressed

➢ Header information: in which we have

the info about the image (n of pixels,

acquisition time ecc).

The image processing can be also analog but it’s

more difficult, we have less operation, and we

can’t repeat them.

First basic operations

  • Geometric operations

: geometric transformation defines

how pixels are to be rearranged in

spatially trasformed image.

They consist in two basic operations:

  1. Determing the coordinates

trasformation mapping the

coordinates of the moving image

pixel to the point of fixed image

  1. Determine the brightness of the

point in the digital grid of the

trasformed image

  • Grey level interpolation

: the brightness of the final pixel is

computed as an interpolation of the

brightness of various point in the

neighborhood.

The discrete point may not fall on the

grid points in the new space. We 2

commons interpolation:

  1. Nearest neighbour: we apply all grey

levels to the nearest pixels (grey

levels don’t change)

  1. We share grey levels among 4 pixels
  • Thresholding

: it converts each pixels into black or

white depending on whether the original

color value is within the threshold

range→the output is a binary image

It’s useful to discriminate the object from

the backgroud.

: the image histogram show how

many times a particular grey levels is

used in the image.

NB: in IRL the histogram is like a

distribution and the peaks can overlap

due to noise.

Two main issues:

  1. We lose the spatial informations
  2. It’s not a unique representation of

the image

Two main pro:

  1. We can see if an image is well

exposed (if the histogram is shifted to

black or white)

  1. We can see if the image has a good

constrast (if the histogram uses all

the grey levels available)

POINT OPERATIONS

: each output pixel’s grey level depends only

upon the grey level of the corresponding input

pixel.

Can be viewed as pixel-by-pixel copying

operations.

linear point operations

The output grey levels is a linear function of the

input one:

′

Where b, the intercept, is the brightness and c is

the contrast; changing b → increase brightness

and we shift the curve; changing c → increase

contrast and we change slope.

  • Brightness enhancement

Increase the birghtness of the image,

shifting the histogram towards the white.

If some pixels go outside the grey level

range, they are saturated and we lose

info.

  • Contrast enhancement

Increase the contrast by stratching the

histogram: some pixels become darker,

others brighter and others remains the

same.

  • Contrast stretching
  1. Take the redundacy information from

different pixels in the same images.

Let’s suppose noise is additive, with a gaussian

distribution with zero mean: if we take M sample

of noise at a point in the image we can do the

avarage, given an infinite number of sample the

mean approaches to zero.

➢ Pros: Short acquisition time and good

gaussian noise reduction

➢ Cons: useless at impulse noise reduction

If we avarage M different acquired images, the

final standard deviation is reduces by a factor of

Image compression

The aim of these tecniques is to create an image

that takes less space but it’s similar to the original

one.

Image data files usally contains redundant

informations and much of that are irrelevant: we

have 2 types of algorithm:

  1. Lossless algoritmh: eliminates only

redundant informations → allow us to

extract exatly the original image

  1. Lossy algorithm: eliminates irrelevant

information → it’s possibile when small

degradations between a decrompressed

image and its original is allowed and we

can recover on an aproximated

reconstruction of the image.

Local operations

: each output pixel’s grey level depends on

the neighbourhood grey level of the

corresponding input pixel→the intensity of the

output image is expressed as the weighted sum

of the intensities of the points in the active

neighbourhood.

: the active neighbourhood is defined as

kernel, which usually has the shape of a squared

of pixels but we can use also different shapes.

Local filters are basically discrete convolution

filters that convolve one image with another.

: Convolution provides a way to multiplying

two arrays of number, usually with a different

size, to obtain a third one. In image processing

context, one of the input arrays is just a grey-

level image and the second is the kernel.

The convolution is performed by sliding the

kernel over the image: each kernel cell

corresponds to an output pixels and it’s

performed by multiplying each cells with the

input pixel and then adding all number together

(the boundaries are more problematic → we add

0 pixels).

If LxL is the dimension of the kernel, the time

required for the convolution is 𝐿

2

→ if the kernel

is separable the time is less because the 2d

convolution can be performed by consecutive

convolution of 1d convolution of a with row and

column.

The quality of an image can be improved in 2

ways:

  1. Reducing the noise (NB: grey level

fluctuations is also noise, so if we reduce

the noise we reduce also contrast).

  1. Enhancing the interesting features, the

edges.

Noise reduction filters

Noise reduction filter are useful to suppress the

high frequencies in the image, i.e smoothing the

image→ we use the convolution (except for

median)

  • Mean filter

[

]

We take the avarage of the neighborhood

→ the output of the pixel is changed with

the mean.

We smooth the image → the constrast

remains the same, what change is the

distance between grey levels.

We decrease the noise in uniform region

and smooth the image → we lose small

details!

  • Gaussian filter

[

]

We have different weight according to

the distance: the pixels closed to the

input one are averaged more.

  • Median filter

: (Non linear operation) Image values

withing a “template” centered at (x,y) are

ordered from min to max, the median

value of the ranking list is the filtered

image value at point (x,y).

This filter is better for the so called “salt

and pepper” noise. In statistical noise all

pixels are noisy, in this type only certain

pixels are affected and they are or black

or white → black and white pixels in

median process are outliers and they are

never taken into consideration.

edge detection filters

Edge detection filters are useful to detecte line-

like local structure in an image → these

techinques rely on the application of gradient

operator (also which depends on the direction)

Edges may also be located by looking for zero-

crossing of the second derivative of the signal or

looking at the first derivative max and min.

Since in the discrete domain the derivative

doesn’t exist, we can approximate this operation

as a difference between pixels foreword or

backword in the image.

For the x direction (same for y)

𝜕𝐼(𝑥, 𝑦)

𝜕𝑥

~

𝐼(𝑥 + 1 , 𝑦) − 𝐼(𝑥, 𝑦)

1

~

𝐼(𝑥, 𝑦) − 𝐼(𝑥 − 1 , 𝑦)

1

In kernel representation

𝑥

= [

] 𝐷

𝑥

= [

]

The first is the following pixel minus the central

one and the second Is the central pixel minus the

previous one.

NB: the minimum kernel must be 3x3 because I

need to consider always the central pixel of the

kernel.

We can do also the “central differences” (in x):

2 ∗

𝜕𝐼(𝑥, 𝑦)

𝜕𝑥

~

𝐼(𝑥 + 1 , 𝑦) − 𝐼(𝑥 − 1 , 𝑦)

1

The filter kernel for enhanced partial

differentiation in x is:

𝑥

𝑒𝑛ℎ = [

]

  • Prewitt filter

Given the same smoothing, one might

wish to approximate partial derivatives

by central differences

[

] = [

] ∗ [ 1 0 − 1 ]

  • Sobel filter

Likewise, the central pixel can be

weighted more to further improve

isotropy, in fact Sobel operator S x

consists

of a “enhanced” partial differentiation

filter in x plus an average filter in y

(otherwise).

between the central pixel of SE and the

pixel of the image, we copy the entire SE

in the output vector.

Application → Expand shapes, fills holes,

smooth boundaries. Can be used as edge

detector subctracting the input image

from the dilated one.

  • Erosion

: the erosion between 2 objects A and

B can be defined as

𝐴 ⊖ 𝐵 = {𝑐 ∈ 𝐸

2

∶ 𝑐 + 𝑏 ∈ 𝐴, 𝑏 ∈ 𝐵}

Definig traslation of object A by a vector t

𝐴

𝑡

= {𝑐 ∈ 𝐸

2

∶ 𝑐 = 𝑎 + 𝑡, 𝑎 ∈ 𝐴}

The erosion can be defined as the

intersection of all the (negative)

translaion

𝐴 ⊖ 𝐵 = ⋂ 𝐴 −𝑏

𝑏∈𝐵

Erosion erodes away the boundaries

region of foregroground pixels that is not

completely sourrounded by other white

pixels→ pixels of object become

backgrounds, the once connected to the

background.

Method → We start to slide the SE on

the image: everytime we have a

COMPLETE match between the all SE and

the pixel of the image, we put 1 only in

the corresponding output pixel.

Application → shrinking of the object, we

expand holes, we remove small things.

NB: the dilation and the erosion are

connected → erode an image is the same to

dilate the background (or dilate the inverse of

the image).

  • Opening

: the opening of an image is an

erosion followed by a dilation

Method →Only those portions of the

image which fit exactly the SE are passed

by the filter, smaller structures are

blocked and excluded from output image.

We are finding the region with the same

shape of SE (so the shape of SE is very

important).

Application → It can open a gap between

object connected by a thin bridge of

pixels. Any region survived by erosion,

are restored by the dilation.

  • Closing

: the closing of an image is a dilation

followed by an erosion

Method → basically we filled the holes.

Application → Smooth contours, fuses

narrow breaks and fills holes keeping the

initial region size.

NB: the shape of the SE is the key!

  • Region filling

: it fills a region A given its boundaries

β(A) (from an edge detection for ex)

Method → x=X 0

is known inside the

boundaries.

We start taking the complement of A,

then we need a seed point inside the

object; the first operation dilate the seed

with SE, then we take the intersection

with A

c

… at certain point you can see that

we have no changes so we stop the

iteration.

𝑘

𝑘− 1

𝑘

𝑘− 1

𝑐

𝐹

𝑘

This is a conditional dilation: you start

from a point and dilate until you reach a

point outside the boundaries.

  • Skeleton

Def: it finds the skeleton S(A) of set A.

Defining: 𝐴 ⊖ 𝑘𝐵 = (((𝐴 ⊝ 𝐵) ⊝

The skeleton is:

𝑘

(𝐴) = (𝐴 ⊖ 𝑘𝐵) − [(𝐴 ⊝ 𝑘𝐵) ∘ 𝐵]

The notation

denotes the kth

iteration of successive erosion of A by B.

Method →basically it’s an iteration of k

erosion and finally an dilation and the we

do the difference between the original

image and results of these successive

erosion and 1 dilation.

Ideally the skeleton should be one line of

pixel and connected, but it’s not

guaranteed.

fourier in image processing

: the Fourier transform is an important tool

which allow us to decompose an image in sin and

cos functions. The output represents the image in

the frequency domain.

NB: lower frequencies → higher distance

A mathematical description of an object can be

achieved as through a series of number, each

term represents the importance of a particular

spatial frequency for that object. Any periodic

signal can be decomposed in a series of

oscillating function and in many practical cases,

we need only few component to have a good

reconstruction of the signal.

fourier transform

➢ Fourier synthesis: to generate a signal as

a weighted combination of its elementary

frequencies

➢ Fourier analysis: to decompose the signal

into its oscillatinf function

➢ Fourier spectrum: amplitude of the varius

frequencies component

: the white noise is a period signal having

equal intensity at different frequencies, giving it a

constant power spectral density.

: the fourier transform produces as output a

complex number (for each frequency) which can

be displayed in two images, either with real and

imaginary part or with magnitude and phase.

In image processing we usually take only the

magnitude of the fourier transformed.

: the fourier transform pair in 1D signal are

given by (rispectively direct and inverse function)

−𝑗 2 𝜋𝑢𝑥

+∞

−∞

𝑗 2 𝜋𝑢𝑥

+∞

−∞

In 2d signal

−𝑗 2 𝜋(𝑢𝑥+𝑣𝑦)

+∞

−∞

+∞

−∞

𝑗 2 𝜋(𝑢𝑥+𝑣𝑦)

+∞

−∞

+∞

−∞

can be seen through the convolution theorem

(infact in spatial domain the operation are called

filters).

Def: given the convolution of the image f(x,y) and

a kernel h(x,y)

𝑓(𝑥, 𝑦) ∗ ℎ(𝑥, 𝑦) = ∑ ∑ 𝑓(𝑚, 𝑛) ∙ ℎ(𝑥 − 𝑚, 𝑦 − 𝑣)

𝑁− 1

𝑦= 0

𝑀− 1

𝑥= 0

F(u,v) and H(u,v) are the fourier transform of f and h

and we can see that the convolution in spatial domain

results as a multiplication in the frequency domain.

filters

There are 2 ways in order to apply a filter:

➢ Spatial domain: convolution with spatial

operators

➢ Frequency domain:

  1. We move to frequency domain using

the fourier trasnform

  1. We multiply the FT and the filter

(filtering the image means multiply

the image with the filter pixel by

pixel)

  1. We do the inverse trasform of the

product to re-obtain the image

Sometimes it’s easier working in the frequency

domain and the FT allow us also to isolate some

frequencies.

  • Low-pass filter

filter which removes high

frequencies.

We can imagine this filter as an image all

black (0) with a white (1) circle at the

center (=ideal low pass filter) →

removing high frequencies means

removing noise and small details: we cut

sharp transition and smooth the image.

➢ Butterwoth Low pass filter

➢ Gaussian Low pass filter

  • High-pass filter

filter which removes low

frequencies.

We can imagine this filter as an image all

white (1) with a black (0) circle at the

center (=ideal high pass filter) →

removing low frequencies means

removing uniform things and extract fine

details: we cut slow transition.

➢ Sharpening High-pass filter

  • Band-pass filter

: A band-pass filter or bandpass filter

(BPF) is a device that passes frequencies

within a certain range and rejects

(attenuates) frequencies outside that

range.

Passing to frequency domain it’s useful when we

have noise with a well defined pattern. Looking at

the spectrum:

➢ When we have a noisy image we can see

frequencies that are not there in the real

image and are due to noise → mainly the

noise is located at high frequency.

➢ When we have a blurred image we miss

some frequencies that are present in the

real spectrum of the image → attention:

you can’t recover this frequencies

because with filter we remove things!

image segmentation

: the image segmentation is partition an

image into meaninful regions with respect to a

particular applications→ it divides the image into

subregions which have simnilarities within the

region and some differences between adjacent

region.

The segmentation is based on measurements

taken from the image, like grey levels, colour,

texture…

The goal is usually find individual object and we

have 2 approaches:

➢ Similarity: may be due to pixel intensity,

color or texture

➢ Discontinuities: changes along an edge.

We have 3 trypes of discontinuities:

points, lines and edges.

The most common way to find a discontinuity is

scan the image with a mask and the mask

determines what kind of discontinuity I can find,

basically doing the convolution between the

mask and the kernel.

As we said for edge detection we can use the first

and second derivative, but if we have noise,

doing the derivate we amplify that noise and it’s

hard to detect the edge (see how looks like the

derivatives of an grey profile of edges).

: the gradient of an image f(x,y) at location

(x,y) is defined as the vector

∇f = [

𝑥

𝑦

] =

[

𝜕𝑦]

: the magnitude: 𝑚𝑎𝑔

[

]

= [𝐺

𝑥

2

𝑦

2

]

1 / 2

: The direction: 𝛼(𝑥, 𝑦) = tan

− 1

𝐺 𝑥

𝐺 𝑦

  • Find individual object by discontinuities:
    • Canny edge detection

: Canny edge detection is a

technique to extract useful structural

information from different vision

objects and dramatically reduce the

amount of data to be processed.

It is perfect for step edges corrupted

by noise.

Requirements :

  1. Detection of edge with low

error rate, which means that

the detection should

accurately catch as many

edges shown in the image as

possible

  1. Edge points should be well

localized: the edges located

must be as close as possible

to the true edges

  1. A given edge in the image

should only be marked once,

and where possible, image

noise should not create false

edges→the edge should be

thin.

Steps :

  1. Smooth the image with a

gaussian filter to reduce noise

  1. Compute the gradient

magnitude and direction at

each pixel of the smoothed

image

  1. Thin the wide ridges around

local maxima: zero out any

pixel response smaller than at

least one of the two

neighbouring pixels on either

side, along the direction of

the gradient.

  1. Use connectivity analysis to

detect and link edges: keep

only pixels along high-

magnitude contours, so weak

little segment go away.

→ Find individual object by similarities:

Typically edge detection is followed by edge

linking designed to assemble edge pixels into

meaningful edges and/or region boundaries.

Two approaches to edge linking:

than T, then p is a pixel object, else p is a

background pixel.

Many approaches possible:

  • Global thresholding
  • Local thresholding
  • Manual thresholding
  • Adaptive thresholding
  • Basic global thresholding

It could be applied to an entire image or a

subregion.

Assumption for thresholding : the range

of intensities levels covered by object of

interest is different from background (the

peaks must be separated).

Steps :

  1. Select an initial estimate for T
  2. Segment the image using T. It will

produces a 2 group of pixels: G1 =

pixels with intensity greater than T,

and G2 = pixel with intensity lower

than T.

  1. Compute the average intensity values

m1 and m2 for pixels in G1 and G2.

  1. Compute the new threshold
  1. Repeat the step 2 through 4 until the

difference between values of T in

successive iterations is smaller than a

predefined parameter ΔT.

  • Otsu thresholding

This method treats pixels values as

probability density functions.

There are 2 kinds of error:

➢ Mislabelling an object pixel as

background

➢ And otherwise

The goal of this method is minimizing the

probability of misclassifying pixels.

Any threshold method separated the

histogram into 2 groups, the

homogeneity of the group is measured by

the within group variance.

: the Otsu thresholding says the

optimum threshold is that threshold

which minimize the within group variance

thus maximizing the homogeneity of each

group.

Let group o (object) be those pixels with

grey level < T; Let group b (background)

be those pixels with grey level > T; the

prior probability of group o is p o

(T), the

prior probability of group b is p b

(T).

𝑜

𝑇

𝑖= 0

𝑏

255

𝑖=𝑇+ 1

Where h(i) is the histogram of an N pixel

image; we are taking the first part of the

histogram before T and the last part after

T.

: the within group variance is defined

𝑤

2

𝑜

2

0

𝑏

2

𝑏

  • We need to determine the optimum

T to minimize the 𝜎

𝑤

2

For an 8-bit image we have 256

comparisons.

To reduce the overlapping of the 2 spikes

we can reduce the noise before

thresholding, for example filtering the

image.

  • Adaptive thresholding

If the background is not uniform but it

has a sort of trend, I can do the image

partitioning, so subdividing the image

into a non-overlapping rectangles, that

are chosen small enough to have uniform

region.

region-based segmentation

: region-based segmentation is based on the

connectivity of similar pixels in a region, which

must be uniform.

Let R represent the entire image region.

Segmentation is a process that partition R into

subregions R 1

,R

2

… such that:

𝑖

𝑛

𝑖= 1

→ partition covers the

whole image

𝑖

is a connected region

𝑖

𝑗

= 0 →no regions intersection

𝑖

) = 𝑇𝑅𝑈𝐸→homogeneity predicate

is satisfied by each region

➢ Union of adjacent regions doesn’t satisfy

it.

Where P is the logical predicate (=what you use

to identify the object) → if P=TRUE if all pixels in

that region have the same grey level.

→all we have to do is define and implement the

similarity predicate.

We have three main approaches:

  • Region growing
  • Clustering
  • Region splitting
  • Region growing

: region growing is a procedure

that groups pixels into larger regions.

Method : we start from a seed point

and we choose the type of

connectivity-, we check if the

predicate it’s true (for ex in 4-point

connectivity if the 4 neighbour points

have the same grey levels.

The region growing based techniques

are better in noisy images where

edges are difficult to detect.

  • Region splitting

: region splitting is the opposite of

the region growing.

Method : first there is a larger region

(possible the entire image), then a

predicate is used to determine if the

region is uniform, if not the method

requires that the region be split into

two (or four) subregions. Then each

of these subregions is independently

tested by predicate; This procedure

continues until all resulting

subregions are uniform.

Issues : the main problem with region

splitting is where split the region, we

can use the quadtree structure: a

tree in which nodes have exactly 4

descendants: we divide the region in

4 and check the predicate, if the

region checked isn’t uniform we

divide it again in 4 subregions.

  • K-means clustering

Method : partition the data in K

clusters and find the centroid of each

one. For each data point: calculate

the distance from the data to each

cluster and assign the data point to

the closest cluster.

Recompute the centroid of each

cluster; repeat steps 2 and 3 until

there is no further change in the

assignment of data points.