Transcript

Computer Vision I -Algorithms and Applications:Basics of Image Processing

Carsten Rother

Computer Vision I: Basics of Image Processing

28/10/2013

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/2013Computer Vision I: Basics of Image Processing 2

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/2013Computer Vision I: Basics of Image Processing 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

28/10/2013Computer Vision I: Basics of Image Processing 4

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”

28/10/2013Computer Vision I: Image Formation Process 5

Images as functions

28/10/2013Computer Vision I: Basics of Image Processing 6

[from Steve Seitz]

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)

28/10/2013Computer Vision I: Basics of Image Processing 7

Comment on Continuous Domain / Range

28/10/2013Computer Vision I: Basics of Image Processing 8

β€’ There is a branch of computer vision research (β€œvariationalmethods”), 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

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/2013Computer Vision I: Basics of Image Processing 9

Point operators

β€’ Point operators work on every pixel independently:𝐽 π‘₯, 𝑦 = β„Ž 𝐼 π‘₯, 𝑦

β€’ Examples for h:

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

28/10/2013Computer Vision I: Basics of Image Processing 10

Contrast enhancedoriginal

Example for Point operators: Gamma correction

28/10/2013Computer Vision I: Basics of Image Processing 11

Intensity range: [0,1]

In (old) CRT monitorsAn 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.

Example for Point Operators: Alpha Matting

28/10/2013Computer Vision I: Basics of Image Processing 12

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

Background 𝐡

Composite 𝐢Matte 𝛼

(amount of transparency)

Foreground 𝐹

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/2013Computer Vision I: Basics of Image Processing 13

Linear Filters / Operators

β€’ Properties:

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

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

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

β€’ Example:

β€’ Convolution

β€’ Matrix-Vector operations

28/10/2013Computer Vision I: Basics of Image Processing 14

Convolution

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

β€’ 2D convolution (discrete)

𝑔 = 𝑓 βˆ— β„Ž

28/10/2013Computer Vision I: Basics of Image Processing 15

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

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

Centred at 0,0

Convolution

28/10/2013Computer 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):𝑔 π‘₯, 𝑦 =

π‘˜,𝑙

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

Examples

28/10/2013Computer Vision I: Basics of Image Processing 17

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

β€’ Box Filter:

x

y𝛿

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/2013Computer Vision: Algorithms and Applications --

- Carsten Rother18

Noise removal

28/10/2013Computer Vision I: Basics of Image Processing 19

The box filter does noise removal

β€’ Box filter takes the mean in a neighbourhood

28/10/2013Computer Vision I: Basics of Image Processing 20

Filtered Image

Image Pixel-independent Gaussian noise added

Noise

Derivation of the Box Filter

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

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

β€’ Noise model: Gaussian noise:

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

2

2𝜎2]

28/10/2013Computer Vision I: Basics of Image Processing 21

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

Derivation of Box Filter

28/10/2013Computer 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

likelihoodprior

Derivation of Box Filter

28/10/2013Computer Vision I: Basics of Image Processing 23

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:

Derivation of Box Filter

28/10/2013Computer 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

Gaussian (Smoothing) Filters

β€’ Nearby pixels are weighted more than distant pixels

β€’ Isotropic Gaussian (rotational symmetric)

28/10/2013Computer Vision I: Basics of Image Processing 25

Gaussian Filter

28/10/2013Computer Vision I: Basics of Image Processing 26

Input: constant grey-value image

More noise needs larger sigma

Handling the Boundary (Padding)

28/10/2013Computer Vision I: Basics of Image Processing 27

Gaussian for Sharpening

28/10/2013Computer Vision I: Basics of Image Processing 28

Sharpen an image by amplifying what is smoothing removes:𝑔 = 𝑓 + 𝛾 (𝑓 βˆ’ β„Žπ‘π‘™π‘’π‘Ÿ βˆ— 𝑓)

How to compute convolution efficiently?

β€’ Separable filters (next)

β€’ Fourier transformation (see later)

β€’ Integral Image trick (see exercise)

28/10/2013Computer Vision I: Basics of Image Processing 29

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

Separable filters

28/10/2013Computer 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

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

β„Žπ‘¦

Can any filter be made separable?

28/10/2013Computer Vision I: Basics of Image Processing 31

Apply SVD to the kernel matrix:

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

Note:

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

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

Example of separable filters

28/10/2013Computer Vision I: Basics of Image Processing 32

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/2013Computer Vision I: Basics of Image Processing 33

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/2013Computer Vision I: Basics of Image Processing 34

Shot noise (Salt and Pepper Noise) - motivation

28/10/2013Computer Vision I: Basics of Image Processing 35

Original + shot noise

Gaussian filtered

Medianfiltered

Another example

28/10/2013Computer Vision I: Basics of Image Processing 36

Original

Mean Median

Noised

Median Filter

28/10/2013Computer Vision I: Basics of Image Processing 37

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

Median Filter: Derivation

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

28/10/2013Computer Vision I: Basics of Image Processing 38

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

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

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

Does not look like a Gaussian distribution

meanmedian

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

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

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

2

For Median we solve the following problem:

Due to absolute norm it is more robust

𝑝 𝑦 π‘₯)

Median Filter Derivation

28/10/2013Computer Vision I: Basics of Image Processing 39

minimize the following: function:

Problem: not differentiable ,good news: it is convex

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

Optimal solution is the mean of all values

Motivation – Bilateral Filter

28/10/2013Computer Vision I: Basics of Image Processing 40

Original + Gaussian noise Gaussian filtered Bilateral filtered

Bilateral Filter – in pictures

28/10/2013Computer Vision I: Basics of Image Processing 41

Bilateral Filter weights Output

Centre pixel

Gaussian Filter weights

Noisy input

Output (sketched)

Bilateral Filter – in equations

28/10/2013Computer 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

Application: Bilteral Filter

28/10/2013Computer Vision I: Basics of Image Processing 43

Cartoonization

HDR compression(Tone mapping)

Joint Bilteral Filter

28/10/2013Computer 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

~ ~

~

Application: combine Flash and No-Flash

28/10/2013Computer Vision I: Basics of Image Processing 45

[Petschnigg et al. Siggraph β€˜04]

input image 𝑓 guidance image 𝑓

We donβ€˜t care about absolute colors

~ Joint Bilateral Filter

~ ~

Application: Cost Volume Filtering

28/10/2013Computer 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

Reminder: Unary term

28/10/2013Computer Vision I: Introduction 47

Optimum with unary terms onlyDark means likely

backgroundDark means likely

foreground

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

New query image 𝑧𝑖

Cost Volumne for Binary Segmenation

28/10/2013Computer Vision I: Basics of Image Processing 48

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

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

Image (x,y)

Lab

el S

pac

e (h

ere

2)

For 2 Labels, we can also look at the ratio Image:𝐼𝑖 = πœƒπ‘–(π‘₯𝑖 = 1) / πœƒπ‘–(π‘₯𝑖 = 0)

Application: Cost Volumne Filtering

28/10/2013Computer Vision I: Basics of Image Processing 49

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]

Application: Cost volume filtering for dense Stereo

28/10/2013Computer 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

~

Application: Cost volume filtering for dense Stereo

28/10/2013Computer Vision I: Basics of Image Processing 51

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]

Recent Trend: Guided Filter

28/10/2013Computer 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]

Recent Trend: Guided Filter

28/10/2013Computer Vision I: Basics of Image Processing 53

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 πœ”π‘˜

𝑓𝑖~

𝑓𝑖~ 𝑓𝑗

~

~ ~

~~

Bilteral Filter and Guided Filter behave very similiarly

28/10/2013Computer Vision I: Basics of Image Processing 54

Bilteral Filter and Guided Filter behave very similiarly

28/10/2013Computer Vision I: Basics of Image Processing 55

Guided Filter Bilteral Filter

Guided Filter: Can be computed in O(N)

28/10/2013Computer Vision I: Basics of Image Processing 56

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

[He, Sun ECCV β€˜10]

Integral Image trick

Applications: Matting

28/10/2013Computer Vision I: Basics of Image Processing 57

Guideanace Image 𝑓~ Input Image 𝑓 Output Image 𝑔

[He, Sun ECCV β€˜10]

Morphological operations

28/10/2013Computer 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

Opening and Closing Operations

28/10/2013Computer Vision I: Basics of Image Processing 59

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

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

closingopeningInput image

erode and dilate are not commutative

Application: Denoise Binary Segmentation

28/10/2013Computer Vision I: Basics of Image Processing 60

Note: nothing is commutative

Closing β†’ than opening

Opening β†’ than closing

Input Segmentation

Application: Binary Segmentation

28/10/2013Computer Vision I: Basics of Image Processing 61

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

Result: Edge preservingOpening 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

Related nonlinear operations on binary images

28/10/2013Computer Vision I: Basics of Image Processing 62

Distance transform

Binary Image

Skeleton

Binary Input Image Connected components

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/2013Computer Vision I: Basics of Image Processing 63

Fourier Transformation … to analyse Filters

28/10/2013Computer 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

Fourier Transform

28/10/2013Computer Vision I: Basics of Image Processing 65

Low-pass filter:

Band-pass filter:

Fourier Pair: Computation

28/10/2013Computer Vision I: Basics of Image Processing 66

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

𝐻 πœ” = βˆ’βˆž

∞

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

∞

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

𝐻 π‘˜ =1

𝑁

π‘₯=0

π‘βˆ’1

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

Discrete Fourier transformationN is the range of signal (image region)

β„Ž(π‘₯) =1

𝑁

π‘˜=0

π‘βˆ’1

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

con

tin

uo

us

dis

cret

e

Inverse Discrete Fourier transformation

Discrete Inverse Fourier Transform: Visualization

28/10/2013Computer Vision I: Basics of Image Processing 67

h(x) =1

𝑁

π‘˜=0

π‘βˆ’1

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

For this signal a reconstruction with sinus function only is sufficient

Discrete Inverse Fourier Transform: Visualization

28/10/2013Computer Vision I: Basics of Image Processing 68

h(x) =1

𝑁

π‘˜=0

π‘βˆ’1

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

[from wikipedia]

Example: Discrete 2D

28/10/2013Computer Vision I: Basics of Image Processing 69

Original Amplitude Phase

Example: Discrete 2D

28/10/2013Computer Vision I: Basics of Image Processing 70

Original Amplitude Phase

Example: Discrete 2D

28/10/2013Computer Vision I: Basics of Image Processing 71

Fast Fourier Transformation

28/10/2013Computer 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)

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/2013Computer Vision I: Basics of Image Processing 73

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/2013Computer Vision I: Introduction 74


Recommended