computational optical imaging - optique numerique...

61
Computational Optical Imaging - Optique Numerique -- Calibration and Features -- Winter 2013 Ivo Ihrke with slides by Thorsten Thormaehlen

Upload: others

Post on 19-Jul-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Computational Optical Imaging -Optique Numerique

-- Calibration and Features --

Winter 2013

Ivo Ihrke

with slides by Thorsten Thormaehlen

Page 2: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Estimating the Camera Matrix

Page 3: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

3D Calibration target

Page 4: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

DLT algorithm

Have correspondences: ; unkown

Projecting a point:

Performing the perspective

division yields

Page 5: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

DLT algorithm II

Solve homogeneous system

(avoid trivial solution a=0)

Perform SVD:

Extract lower-most row of

(right-most column of )

Yields least-squares optimal approximation to null-space

Page 6: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

3D Target – calibrated coordinate system

Plotted 3D points: (0,0,0), (7,0,0), (0,7,0), (0,0,-9)

Page 7: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

3D Target – calibrated coordinate system

Plotted 3D points: (0,0,0), (7,0,0), (0,7,0), (0,0,-9)

Page 8: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Things to note:

Computer vision coordinate systems are often left-handed

OpenGL systems are right-handed

Can simply load into matrix stack

BUT: coordinate system (and clipping) might behave strangely

Convert by “flip matrix”

Page 9: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Page 10: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Page 11: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Accuracy considerations

Extract focal length from intrinsic matrix K

(K11+K22)/2 * pixel size (Nikon D7000: 4.78 um)

View 1: f = 33.65mm

EXIF info: 34.0 mm

View 2: f = 32.93mm

EXIF info: 34.0 mm

Page 12: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Accuracy considerations

Extract focal length from intrinsic matrix K

Variance on image measurements:

sigma = 2 pixels

View 1: f = 33.65 (sigma = 0.67mm)

EXIF info: 34.0 mm

View 2: f = 32.93mm (sigma = 0.72mm)

EXIF info: 34.0 mm

Page 13: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

How to estimate the parameter covariance – analytical - I

1D case – mapping

from measurement space to parameter space

Page 14: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

How to estimate the parameter covariance – analytical - II

Taylor expansion

Valid as long as linearization within holds

Higher Dimensions:

Description of variance covariance matrix

orTool to transfer

standard deviation

from measurements to

model parameters

Page 15: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Error ellipsoid (quadratic,

positive (semi-) definite form)

determined from distribution

E.g. contains

70% of the data for

95% of the data for

How to interpret the covariance matrix

[Zhang96]

Page 16: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

How to estimate the parameter covariance – analytical - III

Higher dimensional Taylor:

with Jacobian matrix

Page 17: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Example: line fit, direct parametrization

- measurements

- measurement positions

-parameter vector

fitting linear system

Ground truth values:

Page 18: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Example: line fit, direct parametrization

- measurements

- measurement positions

-parameter vector

Solve normal equations least squares solution

ground truth

LS fit

Page 19: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Example: line fit, direct parametrization

Jacobian w.r.t. measurements:

Page 20: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Example: line fit, direct parametrization

Jacobian w.r.t. input uncertainty:

Page 21: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Combining covariances from different sources

If the sources are independent, the covariance matrices add

Line example – error due to incorrectly known x and noisy measurements:

Line example:

─ Covariances are negligible

with 95% certainty

Page 22: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Less points – larger variance

with 95% certainty

Page 23: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Monte-Carlo Estimation

Idea: generate synthetic measurements around true measurement and analyze sensitivity of solution

Collect all parameter estimates from perturbed measurements and estimate their statistics

Generating data:

Line example:

─ Perturbing the measurements

─ Perturbing the input positions

Page 24: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Monte-Carlo Estimation

Generating noise according to some covariance matrix

Page 25: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Over-Parameterized Models

In practice: (linear) estimates often over-parameterized

Example line equation:

Line is parameterized by

Problem:

is the same equation

is ill-conditioned (not full rank) and cannot be inverted

Page 26: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Over-Parameterized Models

Idea: invert model in lower-dimensional space where it is full-rank and transfer coordinates

Example: normalized coordinates:

Describes a manifold (the 2-sphere )

in 3D Euclidean parameter space

Page 27: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Over-Parameterized Models

Parameter error may vary off the surface of allowed models

Solution:

Project onto tangent space

Correct to first order

Tangent space

─ can be computed by Jacobian

of some direct parameterization

Page 28: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Over-Parameterized Models

Example: normalized coordinates

Describes a sphere of radius 1

Use spherical coordinates

Set

Page 29: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Then, the covariance transfer can be computed by

Over-Parameterized Models

1. Error ellipsoid in over-parameterized space

2. Error ellipsoid in tangent space

(tangent space coordinates)

3. Error ellipsoid in tangent space

(over-parameterized space coordinates)

Page 30: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Over-Parameterized Models

Example: line fit, implicit representation, same data as before

For comparison,

make sure to use

same constraint analytic

Monte-Carlo

Page 31: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Summary – Uncertainty Estimation

Monte-Carlo

+ Very general

+ Easy to implement

+ Variable dependency and over-parameterization simple

- Slow

Analytical

+ Fast

- Sometimes difficult derivation

- Unflexible (e.g. matrix decompositions are tricky to handle)

- Explicit handling of over-parameterization and variable dependencies

Page 32: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Automatic Checkerboards

[Atcheson et al. “CALTag”]

Page 33: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Automatic Checkerboards

Principal steps:

Detected linked edge segments

Fit lines

Intersect lines to obtain corners

Fit homography to each patch

Sample Code

Classify patch

Optional: if planar, fit homography to all patches

and retry to find additional patches

In all steps: outlier filtering

Page 34: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

What about single-view “natural” scenes?

World-parallel

lines are distorted

vanishing points

Page 35: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Vanishing points

𝐱 𝐳

𝐲

Page 36: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Vanishing points

𝐱 𝐳

𝐲

Page 37: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Vanishing points

Vanishing points are projections of the directions of the coordinate axes

Points at infinity

= intersection of

parallel lines

Page 38: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Vanishing points

can decompose V with RQ decomposition

Fix origin of coordinate system

Page 39: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Accuracy considerations

Extract focal length from intrinsic matrix K

View 1: f = 34.10mm (sigmas ?)

EXIF info: 34.0 mm

View 2: f = 33.45mm (sigmas ?)

EXIF info: 34.0 mm

Page 40: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

3D Reconstruction of Architecture

[Cipolla’99]

Page 41: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Towards Multiple Views and Self-Calibration

Page 42: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Feature detection

Feature tracking

2D homography

Fundamental matrix

Foundations of Camera Motion Estimation

Page 43: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Why bother?

Quelle: Transformers, DreamWorks, Director: Michael Bay, Special effects by Industrial Light & Magic and Digital Domain, USA

Page 44: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Towards Multiple Views and Self-Calibration

-- Feature Detection, Matching and Tracking --

Page 45: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Harris Corner Detector

corners at high image signal gradients in two perpendicular directions

Feature Point Detection

Page 46: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

window point (e.g. 5 x 5 pixels)

image point

Harris Corner Detector

calculate

X-axis

Y-axis

mn

Page 47: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Eigenvalues of the symmetric matrix :

Harris Corner Detector

min

max

Page 48: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Harris Corner Detector

1

2

“Corner”

1 and 2 are large,

1 ~ 2;

1 and 2 are small;

E is almost constant

in all directions“Edge”

1 >> 2

“Edge”

2 >> 1

“Flat”

region

Classification of image

points using eigenvalues

Page 49: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Harris Cornerness Response Function

Determinant of a matrix

Trace of a matrix

Harris Corner Detector

Page 50: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Harris Corner Detector

Input image Cornerness response Threshold Non-maxima suppression

Page 51: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Correspondence Analysis

For video KLT-Tracker (Kanade, Lucas and Tomasi)

Minimization of the SSD between two windows in subsequent camera images to find the displacement vector

Correspondence Analysis – KLT Tracker

window

image K-1 image K

Page 52: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Linearization of the image signal with a Taylor series

KLT Tracker

Finding the minimum by setting the derivative to zero

Page 53: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

KLT Tracker

with

Page 54: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Optical Flow – Horn & Schunck’81

Optical Flow as seen by a

person at the back of a train

• Continuous version of tracking: optical flow

• Apparent motion of brightness patterns in an image

sequence (typically two frames)

• For images: 𝑢( 𝑥): 𝑅2 𝑅2, is a vector valued fct.

• Often visualized as vector field or color coded

Page 55: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Example Yosemite sequencele

ftrigh

t

Flow field (middlebury coding)

Flow field (IPOL coding)

IPOL coding

middlebury coding

Page 56: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

Assume a video 𝐼( 𝑥, 𝑡): 𝑅3 𝑅

Brightness constancy implies𝐼 𝑥 + 𝑢( 𝑥, 𝑡), 𝑡 = 𝐼( 𝑥, 𝑡 + 1)

Look at one particular time step with flow vectors 𝑢 = (𝑢𝑥, 𝑢𝑦)

perform Taylor expansion of 𝐼 𝑥, 𝑡 + 1 :

𝐼 𝑥, 𝑡 + 1 ≈ 𝐼 𝑥, 𝑡 +𝜕𝐼

𝜕𝑥𝑢𝑥 +

𝜕𝐼

𝜕𝑦𝑢𝑦 +

𝜕𝐼

𝜕𝑡+ 𝑂(𝛻2)

implies𝜕𝐼

𝜕𝑥𝑢𝑥 +

𝜕𝐼

𝜕𝑦𝑢𝑦 +

𝜕𝐼

𝜕𝑡= 0

Alternative form: 𝛻𝐼 ∙ 𝑢 +𝜕𝐼

𝜕𝑡= 0

Optical Flow- Derivation

Page 57: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

KLT and optical flow descriptions are differential in nature only suitable for small displacements (up to 2 pixels)

Large displacements are small on a coarser scale

compute displacements on coarse scale

Upsample

Iteratively compute residuals on finer scales

KLT-Tracker: Resolution pyramids

resolution

Page 58: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

KLT-Tracker: Affine mapping for longer sequences

Page 59: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

For video (small displacements)

Minimization of the SSD between two windows in subsequent camera images

Linearization of the image signal with a Taylor series → linear equation system

Linearization only valid for small displacements → Resolution Pyramids

KLT-Tracker summary

Page 60: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

References

1. Multiple View Geometry in Computer Vision, Richard Hartley and

Andrew Zisserman, 2nd Edition, 2003

2. Cipolla, Drummond, Robertson, “Camera Calibration from Vanishing

Points in Images of Architectural Scenes”, BMVC 1999

3. Zhengyou Zhang, “A Flexible New Technique for Camera Calibration”,

PAMI, 2000

implemented in Toolbox:Matlab Calibration Toolbox, Jean-Yves Bouguet 2000http://www.vision.caltech.edu/bouguetj/calib_doc/

4. Atcheson, Heide, Heidrich, “CALTag: High Precision Fiducial Markers

for Camera Calibration.”, VMV2010

implemented in Toolbox:

http://www.cs.ubc.ca/nest/imager/tr/2010/Atcheson_VMV2010_CALTag/

5. Thorsten Thormählen “Zuverlässige Schätzung der Kamerabewegung

aus einer Bildfolge“. PhD thesis, University of Hannover, 2006

Implemented in: Voodoo Camera Tracker,

http://www.digilab.uni-hannover.de.

Page 61: Computational Optical Imaging - Optique Numerique ...giana.mmci.uni-saarland.de/website-template/... · References 1. Multiple View Geometry in Computer Vision, Richard Hartley and

Ivo Ihrke / Winter 2013

6. Jean-Yves Bouguet “Pyramidal implementation of the affine Lucas-Kanade feature tracker”, 2001

7. Horn, Schunck “Determining optical flow“, Artifical Intelligence, 1981

8. Zhang, “Determining the epipolar geometry and its uncertainty”, 1996

References