• Keine Ergebnisse gefunden

Algorithms and Applications:

N/A
N/A
Protected

Academic year: 2022

Aktie "Algorithms and Applications:"

Copied!
74
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Computer Vision I -

Algorithms and Applications:

Basics of Image Processing

Carsten Rother

28/10/2013

(2)

Link to lectures

β€’ Slides of Lectures and Exercises will be online:

http://www.inf.tu-Dresden/index.php?node_id=2091&ln=en (on our webpage > teaching > Computer Vision)

28/10/2013

Computer Vision I: Basics of Image Processing 2

(3)

Roadmap: Basics Digital Image Processing

β€’ Images

β€’ Point operators (ch. 3.1)

β€’ Filtering: (ch. 3.2, ch 3.3, ch. 3.4) – main focus

β€’ Linear filtering

β€’ Non-linear filtering

β€’ Fourier Transformation (ch. 3.4)

β€’ Multi-scale image representation (ch. 3.5)

β€’ Edges (ch. 4.2)

β€’ Edge detection and linking

β€’ Lines (ch. 4.3)

β€’ Line detection and vanishing point detection

(4)

Roadmap: Basics Digital Image Processing

β€’ Images

β€’ Point operators (ch. 3.1)

β€’ Filtering: (ch. 3.2, ch 3.3, ch. 3.4) – main focus

β€’ Linear filtering

β€’ Non-linear filtering

β€’ Fourier Transformation (ch. 3.4)

β€’ Multi-scale image representation (ch. 3.5)

β€’ Edges (ch. 4.2)

β€’ Edge detection and linking

β€’ Lines (ch. 4.3)

β€’ Line detection and vanishing point detection

28/10/2013

Computer Vision I: Basics of Image Processing 4

(5)

What is an Image

β€’ We can think of the image as a function:

𝐼 π‘₯, 𝑦 , 𝐼: βˆ— Γ— βˆ— β†’βˆ—

β€’ For every 2D point (pixel) it tells us the amount of light it receives

β€’ The size and range of the sensor is limited:

𝐼 π‘₯, 𝑦 , 𝐼: π‘Ž, 𝑏 Γ— 𝑐, 𝑑 β†’ [0, π‘š]

β€’ Colour image is then a vector-valued function:

𝐼 π‘₯, 𝑦 =

𝐼𝑅 π‘₯, 𝑦 𝐼𝐺 π‘₯, 𝑦 𝐼𝐡 π‘₯, 𝑦

, 𝐼: π‘Ž, 𝑏 Γ— 𝑐, 𝑑 β†’ 0, π‘š 3

β€’ Comment, in most lectures we deal with grey-valued images and extension to colour is β€œobvious”

(6)

Images as functions

28/10/2013

Computer Vision I: Basics of Image Processing 6

[from Steve Seitz]

(7)

Digital Images

β€’ We usually do not work with spatially continuous functions, since our cameras do not sense in this way.

β€’ Instead we use (spatially) discrete images

β€’ Sample the 2D domain on a regular grid (1D version)

β€’ Intensity/color values usually also discrete.

Quantize the values per channel (e.g. 8 bit per channel)

(8)

Comment on Continuous Domain / Range

28/10/2013

Computer Vision I: Basics of Image Processing 8

β€’ There is a branch of computer vision research (β€œvariational methods”), which operates on continuous domain for input images and output results

β€’ Continuous domain methods are typically used for physics-based vision: segmentation, optical flow, etc. (we may consider this

briefly in later lectures)

β€’ Continues domain methods then use different optimization techniques, but still discretize in the end.

β€’ In this lecture and other lectures we mainly operate in discrete domain and discrete or continuous range for output results

(9)

Roadmap: Basics Digital Image Processing

β€’ Images

β€’ Point operators (ch. 3.1)

β€’ Filtering: (ch. 3.2, ch 3.3, ch. 3.4) – main focus

β€’ Linear filtering

β€’ Non-linear filtering

β€’ Fourier Transformation (ch. 3.4)

β€’ Multi-scale image representation (ch. 3.5)

β€’ Edges (ch. 4.2)

β€’ Edge detection and linking

β€’ Lines (ch. 4.3)

β€’ Line detection and vanishing point detection

(10)

Point operators

β€’ Point operators work on every pixel independently:

𝐽 π‘₯, 𝑦 = β„Ž 𝐼 π‘₯, 𝑦

β€’ Examples for h:

β€’ Control contrast and brightness; β„Ž(𝑧) = π‘Žπ‘§ + 𝑏

28/10/2013

Computer Vision I: Basics of Image Processing 10

Contrast enhanced original

(11)

Example for Point operators: Gamma correction

Intensity range: [0,1]

In (old) CRT monitors

An intensity 𝑧 was perceived as:

β„Ž 𝑧 = 𝑧𝛾 (𝛾 = 2.2 typically) Inside cameras:

β„Ž 𝑧 = 𝑧1/𝛾 where

often 𝛾 = 2.2 (called gamma correction)

Important: for many tasks in vision, e.g. estimation of a normal, it is good to run β„Ž 𝑧 = 𝑧𝛾 to get to a linear function

Today: even with β€œlinear mapping” monitors, it is good to keep the gamma corrected image. Since human vision is more sensitive in dark areas.

(12)

Example for Point Operators: Alpha Matting

28/10/2013

Computer Vision I: Basics of Image Processing 12

𝐢 π‘₯, 𝑦 = 𝛼 π‘₯, 𝑦 𝐹 π‘₯, 𝑦 + 1 βˆ’ 𝛼 π‘₯, 𝑦 𝐡(π‘₯, 𝑦)

Background 𝐡

Composite 𝐢 Matte 𝛼

(amount of transparency) Foreground 𝐹

(13)

Roadmap: Basics Digital Image Processing

β€’ Images

β€’ Point operators (ch. 3.1)

β€’ Filtering: (ch. 3.2, ch 3.3, ch. 3.4) – main focus

β€’ Linear filtering

β€’ Non-linear filtering

β€’ Fourier Transformation (ch. 3.4)

β€’ Multi-scale image representation (ch. 3.5)

β€’ Edges (ch. 4.2)

β€’ Edge detection and linking

β€’ Lines (ch 4.3)

β€’ Line detection and vanishing point detection

(14)

Linear Filters / Operators

β€’ Properties:

β€’ Homogeneity: 𝑇[π‘Žπ‘‹] = π‘Žπ‘‡[𝑋]

β€’ Additivity: 𝑇[𝑋 + π‘Œ] = 𝑇[𝑋] + 𝑇[π‘Œ]

β€’ Superposition: 𝑇[π‘Žπ‘‹ + π‘π‘Œ] = π‘Žπ‘‡[𝑋] + 𝑏𝑇[π‘Œ]

β€’ Example:

β€’ Convolution

β€’ Matrix-Vector operations

28/10/2013

Computer Vision I: Basics of Image Processing 14

(15)

Convolution

β€’ Replace each pixel by a linear combination of its neighbours and itself.

β€’ 2D convolution (discrete) 𝑔 = 𝑓 βˆ— β„Ž

𝑔 π‘₯, 𝑦 = π‘˜,𝑙 𝑓 π‘₯ βˆ’ π‘˜, 𝑦 βˆ’ 𝑙 β„Ž π‘˜, 𝑙 = π‘˜,𝑙 𝑓 π‘˜, 𝑙 β„Ž π‘₯ βˆ’ π‘˜, 𝑦 βˆ’ 𝑙

𝑓 π‘₯, 𝑦 β„Ž π‘₯, 𝑦 g π‘₯, 𝑦

Centred at 0,0

(16)

Convolution

28/10/2013

Computer Vision I: Basics of Image Processing 16

β€’ Linear β„Ž βˆ— 𝑓0 + 𝑓1 = β„Ž βˆ— 𝑓0 + β„Ž βˆ— 𝑓1

β€’ Associative 𝑓 βˆ— 𝑔 βˆ— β„Ž = 𝑓 βˆ— 𝑔 βˆ— β„Ž

β€’ Commutative 𝑓 βˆ— β„Ž = β„Ž βˆ— 𝑓

β€’ Shift-Invariant 𝑔 π‘₯, 𝑦 = 𝑓 π‘₯ + π‘˜, 𝑦 + 𝑙 ↔ β„Ž βˆ— 𝑔 π‘₯, 𝑦 = (β„Ž βˆ— 𝑓)(π‘₯ + π‘˜, 𝑦 + 𝑙)

(behaves everywhere the same)

β€’ Can be written in Matrix form: g = H f

β€’ Correlation (not mirrored filter):

𝑔 π‘₯, 𝑦 =

π‘˜,𝑙

𝑓 π‘₯ + π‘˜, 𝑦 + 𝑙 β„Ž π‘˜, 𝑙

(17)

Examples

β€’ Impulse function: 𝑓 = 𝑓 βˆ— 𝛿

β€’ Box Filter:

x

𝛿

y

(18)

Application: Noise removal

β€’ Noise is what we are not interested in:

sensor noise (Gaussian, shot noise), quantisation artefacts, light fluctuation, etc.

β€’ Typical assumption is that the noise is not correlated between pixels

β€’ Basic Idea:

neighbouring pixel contain information about intensity

28/10/2013 Computer Vision: Algorithms and Applications --

- Carsten Rother 18

(19)

Noise removal

(20)

The box filter does noise removal

β€’ Box filter takes the mean in a neighbourhood

28/10/2013

Computer Vision I: Basics of Image Processing 20

Filtered Image

Image Pixel-independent

Gaussian noise added Noise

(21)

Derivation of the Box Filter

β€’ π‘¦π‘Ÿ is true gray value (color)

β€’ π‘₯π‘Ÿ observed gray value (color)

β€’ Noise model: Gaussian noise:

𝑝 π‘₯π‘Ÿ π‘¦π‘Ÿ) = 𝑁 π‘₯π‘Ÿ; π‘¦π‘Ÿ, 𝜎 ~ exp[βˆ’ π‘₯π‘Ÿβˆ’π‘¦π‘Ÿ

2

2𝜎2 ]

π‘¦π‘Ÿ π‘₯π‘Ÿ

(22)

Derivation of Box Filter

28/10/2013

Computer Vision I: Basics of Image Processing 22

Further assumption: independent noise

Find the most likely solution the true signal 𝑦

Maximum-Likelihood principle (probability maximization):

𝑝(π‘₯) is a constant (drop it out), assume (for now) uniform prior 𝑝(𝑦).

So we get:

𝑝 π‘₯ 𝑦) ~ exp[βˆ’ π‘₯π‘Ÿβˆ’π‘¦π‘Ÿ

2

2𝜎2 ]

π‘Ÿ

π‘¦βˆ— = π‘Žπ‘Ÿπ‘”π‘šπ‘Žπ‘₯𝑦 𝑝 𝑦 π‘₯) = π‘Žπ‘Ÿπ‘”π‘šπ‘Žπ‘₯𝑦 𝑝 𝑦 𝑝 π‘₯ 𝑦 𝑝(π‘₯)

the solution is trivial: π‘¦π‘Ÿ = π‘₯π‘Ÿ for all π‘Ÿ 

additional assumptions about the signal π’š are necessary !!!

𝑝 𝑦 π‘₯) = 𝑝 π‘₯ 𝑦 ∼ exp[βˆ’ π‘₯π‘Ÿ βˆ’ π‘¦π‘Ÿ 2 2𝜎2 ] π‘Ÿ

posterior

likelihood prior

(23)

Derivation of Box Filter

Assumption: not uniform prior 𝑝 𝑦 but …

in a small vicinity the β€œtrue” signal is nearly constant Maximum-a-posteriori:

𝑝 𝑦 π‘₯) ∼ exp[βˆ’ π‘₯π‘Ÿβ€² βˆ’ π‘¦π‘Ÿβ€² 2 2𝜎2 ]

π‘¦π‘Ÿβˆ— = π‘Žπ‘Ÿπ‘”π‘šπ‘Žπ‘₯π‘¦π‘Ÿ exp[βˆ’ π‘₯π‘Ÿβ€² βˆ’ π‘¦π‘Ÿ 2 2𝜎2 ]

π‘¦π‘Ÿβˆ— = π‘Žπ‘Ÿπ‘”π‘šπ‘–π‘›π‘¦π‘Ÿ π‘₯π‘Ÿβ€² βˆ’ π‘¦π‘Ÿ 2

Only one π‘¦π‘Ÿ in a window π‘Š(π‘Ÿ)

For one pixel π‘Ÿ : π‘Ÿ

take neg. logarithm:

(24)

Derivation of Box Filter

28/10/2013

Computer Vision I: Basics of Image Processing 24

π‘¦π‘Ÿβˆ— = π‘Žπ‘Ÿπ‘”π‘šπ‘–π‘›π‘¦π‘Ÿ π‘₯π‘Ÿβ€² βˆ’ π‘¦π‘Ÿ 2

How to do the minimization:

Take derivative and set to 0:

(the average)

π‘¦π‘Ÿβˆ—

Box filter optimal under pixel-independent Gaussian Noise and constant signal in window

𝐹 π‘¦π‘Ÿ = π‘₯π‘Ÿβ€² βˆ’ π‘¦π‘Ÿ 2

(25)

Gaussian (Smoothing) Filters

β€’ Nearby pixels are weighted more than distant pixels

β€’ Isotropic Gaussian (rotational symmetric)

(26)

Gaussian Filter

28/10/2013

Computer Vision I: Basics of Image Processing 26

Input: constant grey-value image

More noise needs larger sigma

(27)

Handling the Boundary (Padding)

(28)

Gaussian for Sharpening

28/10/2013

Computer Vision I: Basics of Image Processing 28

Sharpen an image by amplifying what is smoothing removes:

𝑔 = 𝑓 + 𝛾 (𝑓 βˆ’ β„Žπ‘π‘™π‘’π‘Ÿ βˆ— 𝑓)

(29)

How to compute convolution efficiently?

β€’ Separable filters (next)

β€’ Fourier transformation (see later)

β€’ Integral Image trick (see exercise)

Important for later (integral Image trick):

The Box filter (mean filter) can be computed in 𝑂(𝑁).

Naive implemettaioin would be 𝑂(𝑁𝑀)

where 𝑀 is the number of elements in box filter

(30)

Separable filters

28/10/2013

Computer Vision I: Basics of Image Processing 30

For some filters we have: 𝑓 βˆ— β„Ž = 𝑓 βˆ— (β„Žπ‘₯ βˆ— β„Žπ‘¦) Where β„Žπ‘₯, β„Žπ‘¦ are 1D filters.

Example Box filter:

Now we can do two 1D convolutions:

𝑓 βˆ— β„Ž = 𝑓 βˆ— β„Žπ‘₯ βˆ— β„Žπ‘¦ = (𝑓 βˆ— β„Žπ‘₯) βˆ— β„Žπ‘¦

NaΓ―ve implementation for 3x3 filter: 9N operations versus 3N+3N operations

β„Žπ‘₯ βˆ— β„Žπ‘¦

β„Žπ‘₯

β„Žπ‘¦

(31)

Can any filter be made separable?

Apply SVD to the kernel matrix:

If all πœŽπ‘– are 0 (apart from 𝜎0) then it is separable.

Note:

β„Žπ‘₯ βˆ— β„Žπ‘¦

β„Žπ‘₯

β„Žπ‘₯ β„Žπ‘¦

β„Žπ‘¦

(32)

Example of separable filters

28/10/2013

Computer Vision I: Basics of Image Processing 32

(33)

Roadmap: Basics Digital Image Processing

β€’ Images

β€’ Point operators (ch. 3.1)

β€’ Filtering: (ch. 3.2, ch 3.3, ch. 3.4) – main focus

β€’ Linear filtering

β€’ Non-linear filtering

β€’ Fourier Transformation (ch, 3.4)

β€’ Multi-scale image representation (ch. 3.5)

β€’ Edges (ch. 4.2)

β€’ Edge detection and linking

β€’ Lines (ch. 4.3)

β€’ Line detection and vanishing point detection

(34)

Non-linear filters

β€’ There are many different non-linear filters.

We look at a selection:

β€’ Median filter

β€’ Bilateral filter (Guided Filter)

β€’ Morphological operations

28/10/2013

Computer Vision I: Basics of Image Processing 34

(35)

Shot noise (Salt and Pepper Noise) - motivation

Original + shot noise

Gaussian filtered

Median filtered

(36)

Another example

28/10/2013

Computer Vision I: Basics of Image Processing 36

Original

Mean Median

Noised

(37)

Median Filter

Replace each pixel with the median in a neighbourhood:

Used a lot for post processing of outputs (e.g. optical flow)

5 6 5

4 20 5

4 6 5

5 6 5

4 5 5

4 6 5

β€’ No strong smoothing effect since values are not averaged

β€’ Very good to remove outliers (shot noise)

median

Median filter: order the values and take the middle one

(38)

Median Filter: Derivation

Reminder: for Gaussian noise we did solve the following ML problem

28/10/2013

Computer Vision I: Basics of Image Processing 38

π‘¦π‘Ÿβˆ— = π‘Žπ‘Ÿπ‘”π‘šπ‘Žπ‘₯π‘¦π‘Ÿ exp[βˆ’ π‘₯π‘Ÿβ€² βˆ’ π‘¦π‘Ÿ 2

2𝜎2 ] = π‘Žπ‘Ÿπ‘”π‘šπ‘–π‘›π‘¦π‘Ÿ π‘₯π‘Ÿβ€² βˆ’ π‘¦π‘Ÿ = 1/ π‘Š π‘₯π‘Ÿ

Does not look like a Gaussian distribution median mean

π‘¦π‘Ÿβˆ— = π‘Žπ‘Ÿπ‘”π‘šπ‘Žπ‘₯π‘¦π‘Ÿ exp[βˆ’ π‘₯π‘Ÿβ€² βˆ’ π‘¦π‘Ÿ

2𝜎2 ] = π‘Žπ‘Ÿπ‘”π‘šπ‘–π‘›π‘¦π‘Ÿ |π‘₯π‘Ÿβ€² βˆ’ π‘¦π‘Ÿ| = π‘€π‘’π‘‘π‘–π‘Žπ‘› (π‘Š π‘Ÿ )

2

For Median we solve the following problem:

Due to absolute norm it is more robust 𝑝 𝑦 π‘₯)

(39)

Median Filter Derivation

minimize the following:

function:

Problem: not differentiable , good news: it is convex 

𝐹 π‘¦π‘Ÿ = |π‘₯π‘Ÿβ€² βˆ’ π‘¦π‘Ÿ|

Optimal solution is the mean of all values

(40)

Motivation – Bilateral Filter

28/10/2013

Computer Vision I: Basics of Image Processing 40

Original + Gaussian noise Gaussian filtered Bilateral filtered

(41)

Bilateral Filter – in pictures

Bilateral Filter weights Output

Centre pixel

Gaussian Filter weights

Noisy input

Output (sketched)

(42)

Bilateral Filter – in equations

28/10/2013

Computer Vision I: Basics of Image Processing 42

Filters looks at: a) distance of surrounding pixels (as Gaussian) b) Intensity of surrounding pixels

Problem: computation is slow 𝑂 𝑁𝑀 ; approximations can be done in 𝑂(𝑁)

Comment: Guided filter (see later) is similar and can be computed exactly in 𝑂(𝑁) See a tutorial on: http://people.csail.mit.edu/sparis/bf_course/

Similar to Gaussian filter Consider intensity Linear combination

(43)

Application: Bilteral Filter

Cartoonization

HDR compression (Tone mapping)

(44)

Joint Bilteral Filter

28/10/2013

Computer Vision I: Basics of Image Processing 44

Similar to Gaussian Consider intensity

f is the input image – which is processed

f is a guidance image – where we look for pixel similarity

~ ~

~

(45)

Application: combine Flash and No-Flash

[Petschnigg et al. Siggraph β€˜04]

input image 𝑓 guidance image 𝑓

We donβ€˜t care about absolute colors

~ Joint Bilateral Filter

~ ~

(46)

Application: Cost Volume Filtering

28/10/2013

Computer Vision I: Basics of Image Processing 46

Goal

Given z; derive binary x:

Algorithm to minimization: π’™βˆ— = π‘Žπ‘Ÿπ‘”π‘šπ‘–π‘›π‘₯ 𝐸(𝒙)

𝒛 = 𝑅, 𝐺, 𝐡 𝑛 x = 0,1 𝑛

Reminder from first Lecture: Interactive Segmentation

Model: Energy function 𝑬 𝒙 = π‘–πœƒπ‘– π‘₯𝑖 + 𝑖,𝑗 πœƒπ‘–π‘—(π‘₯𝑖, π‘₯𝑗)

Unary terms Pairwise terms

(47)

Reminder: Unary term

Optimum with unary terms only

Dark means likely background

Dark means likely foreground

πœƒπ‘–(π‘₯𝑖 = 0) πœƒπ‘–(π‘₯𝑖 = 1)

New query image 𝑧𝑖

(48)

Cost Volumne for Binary Segmenation

28/10/2013

Computer Vision I: Basics of Image Processing 48

πœƒπ‘–(π‘₯𝑖 = 0) πœƒπ‘–(π‘₯𝑖 = 1)

Image (x,y)

Label Space (here 2)

For 2 Labels, we can also look at the ratio Image:

𝐼𝑖 = πœƒπ‘–(π‘₯𝑖 = 1) / πœƒπ‘–(π‘₯𝑖 = 0)

(49)

Application: Cost Volumne Filtering

An alternative to energy minimization

Filtered cost volume

Energy minimization Guidance Input Image 𝑓

(user brush strokes)

Winner takes all Result

Ratio Cost-volume is the Input Image 𝑓

~

[C. Rhemann, A. Hosni, M. Bleyer, C. Rother, and M. Gelautz, Fast Cost- Volume Filtering for Visual Correspondence and Beyond, CVPR 11]

(50)

Application: Cost volume filtering for dense Stereo

28/10/2013

Computer Vision I: Basics of Image Processing 50

Stereo result (winner takes all) 20-label cost

volume 𝑓 Box filter

True solution Bilateral filter Guided filter Guidance Image 𝑓

[C. Rhemann, A. Hosni, M. Bleyer, C. Rother, and M. Gelautz, Fast Cost- Volume Filtering for Visual Correspondence and Beyond, CVPR 11]

Stereo Image pair

~

(51)

Application: Cost volume filtering for dense Stereo

Very competative in terms of results for a fast methods (Middleburry Ranking)

[C. Rhemann, A. Hosni, M. Bleyer, C. Rother, and M. Gelautz, Fast Cost- Volume Filtering for Visual Correspondence and Beyond, CVPR 11]

(52)

Recent Trend: Guided Filter

28/10/2013

Computer Vision I: Basics of Image Processing 52

Diferent pixel coordinates 𝑖, 𝑗 linear combination of image 𝑓

Size of window πœ”π‘˜ is fixed, e.g. 7x7.

Sum over all windows πœ”π‘˜which contain pixels: 𝑖 and 𝑗

β€žDifferent to biltarel filter since a sum over small windowsβ€œ

πœ”π‘˜ 7x7 pixels

𝑖

[He, Sun ECCV β€˜10]

(53)

Recent Trend: Guided Filter

Diferent pixel cooridinates 𝑖, 𝑗 linear combination of image 𝑓

A window πœ”π‘˜which is centred exactly on the edge Size of window πœ”π‘˜ is fixed, e.g. 7x7.

Sum over all windows πœ”π‘˜which contain pixels: 𝑖 and 𝑗

β€žDifferent to biltarel filter since a sum over small windowsβ€œ

Case 1: 𝐼𝑖 , 𝐼𝑗 on the same side: 𝑓𝑖 βˆ’ πœ‡π‘˜ (𝑓𝑗 βˆ’ πœ‡π‘˜) have the same sign. Then π‘Šπ‘–π‘— large Case 2: 𝐼𝑖 , 𝐼𝑗 on the same side: 𝑓𝑖 βˆ’ πœ‡π‘˜ (𝑓𝑗 βˆ’ πœ‡π‘˜) have different sign. Then π‘Šπ‘–π‘— small

variance in window πœ”π‘˜ mean in window πœ”π‘˜

𝑓~𝑖

𝑓~𝑖 𝑓~𝑗

~ ~

~ ~

(54)

Bilteral Filter and Guided Filter behave very similiarly

28/10/2013

Computer Vision I: Basics of Image Processing 54

(55)

Bilteral Filter and Guided Filter behave very similiarly

Guided Filter Bilteral Filter

(56)

Guided Filter: Can be computed in O(N)

28/10/2013

Computer Vision I: Basics of Image Processing 56

Can also be written as: (see paper for detail)

[He, Sun ECCV β€˜10]

Integral Image trick

(57)

Applications: Matting

Guideanace Image 𝑓~ Input Image 𝑓 Output Image 𝑔

[He, Sun ECCV β€˜10]

(58)

Morphological operations

28/10/2013

Computer Vision I: Basics of Image Processing 58

β€’ Perform convolution with a β€œstructural element”:

binary mask (e.g. circle or square)

β€’ Then perform thresholding to recover a binary image

black is 1 white is 1

(59)

Opening and Closing Operations

β€’ Opening operation: π‘‘π‘–π‘™π‘Žπ‘‘π‘’ π‘’π‘Ÿπ‘œπ‘‘π‘’ 𝑓, 𝑠 , 𝑠

β€’ Closing opertiaon: π‘’π‘Ÿπ‘œπ‘‘π‘’ π‘‘π‘–π‘Žπ‘™π‘‘π‘’ 𝑓, 𝑠 , 𝑠

closing opening

Input image

erode and dilate are not commutative

(60)

Application: Denoise Binary Segmentation

28/10/2013

Computer Vision I: Basics of Image Processing 60

Note: nothing is commutative

Closing β†’ than opening Opening β†’ than closing

Input

Segmentation

(61)

Application: Binary Segmentation

[Criminisi, Sharp, Blake, GeoS: Geodesic Image Segmentation, ECCV 08]

Result: Edge preserving Opening and closing

Extend morphological operations to deal with cost volume and make it edge preserving (same idea as in joint bilateral filter)

Again: An alternative to energy minization

Ratio Cost-volume is the Input Image 𝑓

Energy minimization

Energy

minimization

ours

(62)

Related nonlinear operations on binary images

28/10/2013

Computer Vision I: Basics of Image Processing 62

Distance transform Binary

Image

Skeleton

Binary Input Image Connected components

(63)

Roadmap: Basics Digital Image Processing

β€’ Images

β€’ Point operators (Ch. 3.1)

β€’ Filtering: (ch. 3.2, ch 3.3, ch. 3.4) – main focus

β€’ Linear filtering

β€’ Non-linear filtering

β€’ Fourier Transformation (ch. 3.4)

β€’ Multi-scale image representation (ch. 3.5)

β€’ Edges (Ch. 4.2)

β€’ Edge detection and linking

β€’ Lines (Ch 4.3)

β€’ Line detection and vanishing point detection

(64)

Fourier Transformation … to analyse Filters

28/10/2013

Computer Vision I: Basics of Image Processing 64

Complex valued, continuous

sinusoid for different frequency πœ”

π‘œ π‘₯ = β„Ž π‘₯ βˆ— 𝑠 π‘₯ = 𝐴 𝑒𝑗(𝑀π‘₯+πœ™) = 𝐴 [ cos(πœ” π‘₯ + πœ™) + 𝑗 𝑠𝑖𝑛(πœ” π‘₯ + πœ™) ] Amplitude phase

Simply try all possible πœ” and record 𝐴, πœ™ . The Fourier transformation of β„Ž(π‘₯) is then:

𝐻 πœ” = β„Ž π‘₯ = 𝐴 π‘’π‘—πœ™ = 𝐴 (cos πœ™ + 𝑗 sin πœ™ )

Filter/Image

How does a sinusoid influences a given filter/Image β„Ž(π‘₯) ?

Output signal

The output is also a sinusoid

(65)

Fourier Transform

Low-pass filter:

Band-pass filter:

(66)

Fourier Pair: Computation

28/10/2013

Computer Vision I: Basics of Image Processing 66

β„Ž π‘₯ ↔ 𝐻(πœ”) 𝐻 πœ” =

βˆ’βˆž

∞

β„Ž π‘₯ π‘’βˆ’π‘—πœ”π‘₯ 𝑑π‘₯ β„Ž π‘₯ =

βˆ’βˆž

∞

𝐻 πœ” π‘’π‘—πœ”π‘₯ 𝑑ω

𝐻 π‘˜ = 1

𝑁 π‘₯=0 π‘βˆ’1

β„Ž π‘₯ π‘’βˆ’π‘—2πœ‹π‘˜π‘₯𝑁

Discrete Fourier transformation N is the range of signal (image region)

β„Ž(π‘₯) = 1

𝑁 π‘˜=0 π‘βˆ’1

𝐻 π‘˜ 𝑒𝑗2πœ‹π‘˜π‘₯𝑁

continuousdiscrete

Inverse Discrete Fourier transformation

(67)

Discrete Inverse Fourier Transform: Visualization

h(x) = 1

𝑁 π‘˜=0 π‘βˆ’1

𝐻 π‘˜ 𝑒𝑗2πœ‹π‘˜π‘₯𝑁

For this signal a reconstruction with sinus function only is sufficient

(68)

Discrete Inverse Fourier Transform: Visualization

28/10/2013

Computer Vision I: Basics of Image Processing 68

h(x) = 1

𝑁 π‘˜=0 π‘βˆ’1

𝐻 π‘˜ 𝑒𝑗2πœ‹π‘˜π‘₯𝑁

[from wikipedia]

(69)

Example: Discrete 2D

Original Amplitude Phase

(70)

Example: Discrete 2D

28/10/2013

Computer Vision I: Basics of Image Processing 70

Original Amplitude Phase

(71)

Example: Discrete 2D

(72)

Fast Fourier Transformation

28/10/2013

Computer Vision I: Basics of Image Processing 72

β€’ Important property: (𝑔 π‘₯ βˆ— β„Ž π‘₯ ) = 𝐺(πœ”) 𝐻(πœ”)

β€’ Fast computation:

𝑓 π‘₯ , β„Ž(π‘₯) O(Nw)

convolution 𝑓 π‘₯ βˆ— β„Ž(π‘₯)

𝐹 πœ” , 𝐻(πœ”)

O(N logN)

fourier transform

O(N) multiplication

O(N logN)

inverse fourier transform

𝐹 πœ” 𝐻(πœ”)

O(N log N)

(73)

Roadmap: Basics Digital Image Processing

β€’ Images

β€’ Point operators (Ch. 3.1)

β€’ Filtering: (ch. 3.2, ch 3.3, ch. 3.4) – main focus

β€’ Linear filtering

β€’ Non-linear filtering

β€’ Fourier Transformation (ch. 3.4)

β€’ Multi-scale image representation (ch. 3.5)

β€’ Edges (Ch. 4.2)

β€’ Edge detection and linking

β€’ Lines (Ch 4.3)

β€’ Line detection and vanishing point detection

(74)

Reading for next class

This lecture:

β€’ Chapter 3 (in particular: 3.2, 3.3) - Basics of Digital Image Processing

Next lecture:

β€’ Chapter 3.5: multi-scale representation

β€’ Chapter 4.2 and 4.3 - Edge and Line detection

β€’ Chapter 2 (in particular: 2.1, 2.2) – Image formation process

β€’ And a bit of Hartley and Zisserman – chapter 2

28/10/2013

Computer Vision I: Introduction 74

Referenzen

Γ„HNLICHE DOKUMENTE

Die Elektrotechnik bezeichnet Schaltungen als Filter, die ein elektrisches Signal.. abhΓ€ngig von der Frequenz in der Amplitude und

schwÀcht alle Frequenzen außerhalb eines Intervalls ab und lÀsst die Frequenzen innerhalb mâglichst

You can iterate between: intersection and re-sectioning to get all points and cameras reconstructed (in projective or metric space).. Similiar problem as intersection (and same

β€’ Undirected graphical model (also called Markov Random Field).. β€’ Factor graphs (which we will

Generative Models are used successfully when

We want to classify the white pixel Feature: color of the green pixel Parameters: 2D offset vector. 1-dimensional: We want to classify the

β€’ Image categorization: Generative versus Discriminative Approach (finalize from last lecture).. β€’

Ein Objekt bewegt sich entlang einer Bahn (BlutgefÀß) und wird dabei verfolgt. β€žZustandβ€œ beschreibt Position, Geschwindigkeit, Dicke, unterwegs gesehene