Image Processing

Transcription

Image Processing
Image Processing
Daniel Danilov
July 13, 2015
Overview
1. Principle of digital images and filters
2. Basic examples of filters
3. Edge detection and segmentation
1 / 25
Motivation
For what image processing in medicine?
Adaptation to human perception
I
Adapt image’s brightness
I
Reduction of noise
I
Contrast enhancement
I
...
Computer based image analysis
I
Differentiate tissue (segmentation)
I
3D based diagnostics
2 / 25
Digital images
I
Each image consist of N × M
picture elements (pixels)
I
Every pixel displays a gray value
P(x, y )
I
P(x, y ) is stored as an integer
0 . . . 255 (8 bit)
From: soonet.ca
From: processing.org
Images are N × M matrices of integers. We can manipulate
these integers!
3 / 25
Working principle of filters
I
Define a Mask with central Pixel
P(x, y ) and n neighbor pixels
M(2n+1)×(2n+1) (x, y )
I
Filtered image P̃ arises from
convolution with M
n
n
P
P
P(x + i, y + j) · M(i, j)
i=−n j=−n
I
Use Convolution theorem
F(P̃) = F(P) · F(M)
From: H. Handels: Medizinische
Bildverarbeitung
4 / 25
Working principle of filters
I
Define a Mask with central Pixel
P(x, y ) and n neighbor pixels
M(2n+1)×(2n+1) (x, y )
I
Filtered image P̃ arises from
convolution with M
n
n
P
P
P(x + i, y + j) · M(i, j)
i=−n j=−n
From: H. Handels: Medizinische
Bildverarbeitung
From: soonet.ca (edited)
4 / 25
Working principle of filters
I
These filters take into account
the local vicinity of the pixel:
Local filters
I
Point filters:
Surrounding pixels are not
considered
e.g. inversion, darken/lighten
From: med-ed.virginia.edu
From: H. Handels: Medizinische
Bildverarbeitung
5 / 25
Example: Mean filter
From: H. Handels: Medizinische
Bildverarbeitung
6 / 25
Example: Mean filter
From: H. Handels: Medizinische
Bildverarbeitung
6 / 25
Example: Mean filter
From: H. Handels: Medizinische Bildverarbeitung
I
Mean filter reduces inhomogeneities
I
single outlier effects neighbor pixels
I
Strong blurring effect
(unsharp image)
7 / 25
Example: Median filter
From: hindawi.com
I
Salt and pepper noise
I
Caused by defect detectors
8 / 25
Example: Median filter
From: hindawi.com (Mean filter applied)
I
Mean filter does not
remove this noise
I
Noise is smeared over neighbor
pixels
Use median filter!
8 / 25
Example: Median filter
I
Consider the sequence S = {17, 5, 42, 2, 51}
I
The median of S is the value in the middle of the ascending
sorted sequence of S
I
Ascending sorting: {2, 5, 17, 42, 51}
⇒ Median value: 17
9 / 25
Example: Median filter
I
Single pixel has outstanding gray value (salt and pepper)
{0, 8, 11, 13, 17, 21, 24, 31, 255}
10 / 25
Example: Median filter
I
Single pixel has outstanding gray value (salt and pepper)
{0, 8, 11, 13, 17, 21, 24, 31, 255}
10 / 25
Example: Median filter
I
Zoomed in on an edge (black-white transition)
{33, 47, 65, 189, 205, 211, 247, 249, 255}
11 / 25
Example: Median filter
From: hindawi.com (Median filter applied)
I
Median filter removes reliably salt and pepper noise
I
Preserves sharpness of the edges very well
I
Very little blurring effect compared to mean filter
12 / 25
Edge detection: Motivation
From: comp.nus.edu.sg
From: keystonemedicalus.com
How to teach a computer to distinguish between different tissues?
13 / 25
Edge detection: Motivation
From: radiologie-ffm.de
From: H. Handels
I
Tissues are separated by steep changes of grey values
I
Corresponds to steep gradient values
Use differentiation filters!
14 / 25
Edge detection: Basics
From: H. Handels
On an edge . . .
I
1st derivative maximal
I
2nd derivative zero
15 / 25
Edge detection: Discrete differentiation
Let f (x, y ) be the grey values of the image at pixel x and y
!
∂f
I
2D derivative: ∇f (x, y ) =
I ∂f
∂x
≈
f (x,y )−f (x−1,y )
x−(x−1)
∂x
∂f
∂y
= f (x, y ) − f (x − 1, y )
I ∂f
∂y
I
= f (x, y ) − f (x, y − 1)
r
2
∂f 2
∂f
+
|∇f (x, y )| =
∂x
∂y
tan Φ(x, y ) =
∂y f (x,y )
∂x f (x,y )
From: H. Handels: Medizinische Bildverarbeitung
16 / 25
Edge detection: Gradient image
Plot gradient magnitude |∇f (x, y )|
From: siemens.com (filtered)
Better results via Sobel- and Prewitt-filter
17 / 25
Edge detection: Sobel- and Prewitt-filter
I
Combination of filters possible
I
Sobel- and Prewitt-filter:
Mean filter + differentiation filter
From: H. Handels: Medizinische Bildverarbeitung
18 / 25
Edge detection: Sobel- and Prewitt-filter
From: siemens.com (filtered)
I
Sobel-filter enhances edges
I
But makes them also wider and slightly blurred
19 / 25
Segmentation: Difficulties
I
Fully automatic segmentation does not exist due to . . .
I
I
I
low image quality
complex structures of human body
Steering of segmentation precess by humans needed
Goal: Try to minimize human intervention
I
Leads e.g. to better comparability
20 / 25
Segmentation: Live wire technique
I
Ansatz: Find optimal path between start node and further
goal nodes
From: Barrett, Mortensen: Interactive Live-Wire Boundary Extraction
21 / 25
Segmentation: Live wire technique
What is the optimal path?
~i ) to direct link from pixel p~ to its
Assign local cost L(~
p, q
~i
neighbours q
~i ) = ωG · fG (~
~i )
L(~
p, q
qi ) + ωZ · fZ (~
qi ) + ωD · fD (~
p, q
~i − p~ with lowest cost
Path follows the direction q
22 / 25
Segmentation: Live wire technique
~i ) = ωG · fG (~
~i )
L(~
p, q
qi ) + ωZ · fZ (~
qi ) + ωD · fD (~
p, q
I
I
Weights ω: ωG = ωZ = 0.43
ωD = 0.14 (empirical!)
fG (~
qi ): Gradient magnitude (G) function
fG (~
qi ) = 1 −
I
fZ (~
qi ): Laplacian zero-crossing function
fZ (~
qi ) = 0 for |∆I(~
qi )| = 0
I
G(~
qi )
max(G)
fZ = 1 otherwise
~i ): Gradient direction function (prefer smooth curves)
fD (~
p, q
23 / 25
Segmentation: Live wire technique
I
User sets seed points
I
Algorithm connects seed
points via path of lowest
cost
Advantages
I
I
I
I
Little human
interaction needed
Precise, fast and
interactive
Drawbacks
I
I
Stronger near edges
distract path
Noise reduces precision
From: Barrett, Mortensen:
Interactive Live-Wire Boundary
Extraction
24 / 25
Summary
I
Filters convolute the image with predefined masks
I
Examples: Mean and median filters for noise reduction
I
Edge detection possible via differentiation masks
I
Edges are basis for segmenting the image
I
Segmentation via Live Wire Technique
25 / 25