Camera Drones Lecture 3 3D data generation

38
Camera Drones Lecture 3 3D data generation Ass.Prof. Friedrich Fraundorfer WS 2019

Transcript of Camera Drones Lecture 3 3D data generation

Page 1: Camera Drones Lecture 3 3D data generation

Camera Drones

Lecture 3 – 3D data generation

Ass.Prof. Friedrich Fraundorfer

WS 2019

Page 2: Camera Drones Lecture 3 3D data generation

Outline

Structure-from-Motion

▫ SfM introduction

▫ SfM concept

▫ Feature matching

▫ Camera pose estimation

▫ Bundle adjustment

Dense matching

Data products (Orthophoto, DSM)

2

Page 3: Camera Drones Lecture 3 3D data generation

DSM

3

Page 4: Camera Drones Lecture 3 3D data generation

Orthophoto

4

Page 5: Camera Drones Lecture 3 3D data generation

Structure-from-Motion (SfM) concept

5

Page 6: Camera Drones Lecture 3 3D data generation

Structure-from-Motion (SfM) concept

Initialize Motion

(P1,P2 compatible with F)Initialize Structure

(minimize reprojection error)

Extend motion

(compute pose through matches

seen in 2 or more previous views)

Extend structure

(Initialize new structure,

refine existing structure)

Page 7: Camera Drones Lecture 3 3D data generation

Structure-from-Motion (SfM) core pipeline

7

Feature

Extraction

Coarse

Matching

Detailed

Matching

Geometric

VerificationGeometric

Estimation

Local

Descriptors

Image

OverlapMatches

Epipolar

Graph

Camera Poses

3D Points

ImagesPose

PriorCalibration

Pose

Prior

Page 8: Camera Drones Lecture 3 3D data generation

Camera

Calibration

Structure-

from-Motion

(SfM)

Georegistra

tion by GPS

Bundle

Adjustment

with GCP‘s

+ GPS

Densificatio

n and

Fusion

Surface

Reconstruct

ion and

Meshing

Image

Acquisition

Structure-from-Motion (SfM) overall pipeline

8

Page 9: Camera Drones Lecture 3 3D data generation

Feature extraction

SIFT features (best working features for matching right now)

Each descriptor is a vector of length 128 (gradient histogram)

9

Page 10: Camera Drones Lecture 3 3D data generation

Coarse matching

Cluster similar images by similarity using visual words

Will be used for speeding up exhaustive (nxn) matching

Image similarity10

Page 11: Camera Drones Lecture 3 3D data generation

Detailed matching

Typically using NN-search with a Kd-tree

11

Page 12: Camera Drones Lecture 3 3D data generation

Epipolar graph

Defines the sequential order for geometry processing

Is a plot of the number of geometrically verified feature matches

Epipolar graphImage similarity

12

Page 13: Camera Drones Lecture 3 3D data generation

Geometry estimation

Following the sequence ordering from the epipolar graph geometry is

estimated for all images

Geometry estimation is an alternating scheme:

▫ Estimate camera pose of new images (position, rotation)

▫ Triangulate new 3D data points seen in new image

▫ Refinement by non-linear optimization (Bundle adjustment)

13

Page 14: Camera Drones Lecture 3 3D data generation

Geometry estimation steps

Compute camera poses of the first two images from feature matches

14

𝑃 = 𝐾[𝐼|0] 𝑃′ = 𝐾′[𝑅′|𝑡′]

Page 15: Camera Drones Lecture 3 3D data generation

Geometry estimation steps

Computation of first 3D points by triangulation

15

𝑃 = 𝐾[𝐼|0] 𝑃′ = 𝐾′[𝑅′|𝑡′]

Page 16: Camera Drones Lecture 3 3D data generation

Geometry estimation steps

Triangulate all feature matches of the first images

16

𝑃 = 𝐾[𝐼|0] 𝑃′ = 𝐾′[𝑅′|𝑡′]

Page 17: Camera Drones Lecture 3 3D data generation

Geometry estimation steps

First refinement of camera poses and 3D points by non-linear estimation

of the re-projection error through bundle adjustment

17

𝑃 = 𝐾[𝐼|0] 𝑃′ = 𝐾′[𝑅′|𝑡′]

Page 18: Camera Drones Lecture 3 3D data generation

Geometry estimation steps

Start processing the next image

18

𝑃 = 𝐾[𝐼|0] 𝑃′ = 𝐾′[𝑅′|𝑡′]𝑃′′ =?

Page 19: Camera Drones Lecture 3 3D data generation

Geometry estimation steps

First, create feature matches to all the previous, neighboring images

19

𝑃 = 𝐾[𝐼|0] 𝑃′ = 𝐾′[𝑅′|𝑡′]𝑃′′ =?

Page 20: Camera Drones Lecture 3 3D data generation

Geometry estimation steps

Feature matches give correspondences to already computed 3D points

From corresponding 2D and 3D points the pose of the new camera can

be computed using the PnP-Algorithm

20

𝑃 = 𝐾[𝐼|0] 𝑃′ = 𝐾′[𝑅′|𝑡′]𝑃′′ =?

Page 21: Camera Drones Lecture 3 3D data generation

Geometry estimation steps

Repeat the process starting again from triangulation of new features

21

𝑃 = 𝐾[𝐼|0] 𝑃′ = 𝐾′[𝑅′|𝑡′]

𝑃′′ = 𝐾′′[𝑅′′|𝑡′′]

Page 22: Camera Drones Lecture 3 3D data generation

Bundle adjustment

Levenberg-Marquard optimization of re-projection error

Parameters are camera poses and all 3D points (millions of parameters

to optimize!)

22

C

y

x

xi

Xi

z PXi

min𝑃𝑗,𝑋𝑖

𝑖

𝑗

𝑥𝑖,𝑗 − 𝑃𝑗𝑋𝑖

Page 23: Camera Drones Lecture 3 3D data generation

3 paradigms

23

sequential

hierarchical

global

Page 24: Camera Drones Lecture 3 3D data generation

Dense matching

SfM only gives sparse 3D data

Only SIFT feature points are triangulated – for most pixel no 3D data is

computed

Dense image matching computes a 3D point for every pixel in the image

(1MP image leads to 1 million 3D points)

Dense matching algorithms need camera poses as prerequisite

24

Page 25: Camera Drones Lecture 3 3D data generation

Geometric relation

Stereo normal case

Depth Z [m] can be computed from disparity d [pixel]

25

𝑑 = 𝑓𝐵

𝑍

disparity d

baseline b

focal length f

depth Z

Page 26: Camera Drones Lecture 3 3D data generation

Rectification

Image transformation to simplify the correspondence search

Makes all epipolar lines parallel

Image x-axis parallel to epipolar line

Corresponds to parallel camera configuration

„Stereo normal case“Before rectification

26

Page 27: Camera Drones Lecture 3 3D data generation

Dense matching process

Estimate disparity (depth) for all pixels in image left.

Evaluate correspondence measure for every possible pixel location

on the line (e.g. NCC, SAD)

Disparity d: Offset between pixel p in the left image and its

correspondent pixel q in the right image.

Left View Right View

lI rI D

Disparity image*

27

Page 28: Camera Drones Lecture 3 3D data generation

Census Transform

A popular block matching cost

Good robustness to image changes (e.g. brightness)

Matching cost is computed by comparing bit strings using the Hamming

distance (efficient)

Bit strings encode if a pixel within a window is greater or less than the

central pixel (0 .. if center pixel is smaller, 1 .. if center pixel is larger)

28

89 63 72

67 55 64

58 51 49

00000011

Page 29: Camera Drones Lecture 3 3D data generation

Dense matching process

29

reference image matching image

epipolar

line

matching

cost

depth

Page 30: Camera Drones Lecture 3 3D data generation

Disparity selection

Single scanline based

▫ Winner takes all (WTA)

Select the disparity with the lowest cost (i.e. the highest similarity)

▫ Scanline optimization (Dynamic programming)

Select the disparities of the whole scanline such that the total (added up)

costs for a scanline is minimal

Global methods (Cost volume optimization)

▫ Belief propagation

Selects the disparities such that the total cost for the whole image is minimal

▫ Semi-global Matching

Approximates the optimization of the whole disparity image

30

Page 31: Camera Drones Lecture 3 3D data generation

Dense matching process

31

matching image

matching

cost

depth

cost column

Page 32: Camera Drones Lecture 3 3D data generation

Dense matching process

32

cost column

matching image

cost volume

Page 33: Camera Drones Lecture 3 3D data generation

Semiglobal matching

Dense Cost

Computation

Cost Aggregation

Disparity

Selection

LR Check,

FilteringDisparity images

D(p), D(q)

Page 34: Camera Drones Lecture 3 3D data generation

Plane sweep method

Costs are created by “sweeping” a plane across the scene

Method suitable for more than 2 images

34

Page 35: Camera Drones Lecture 3 3D data generation

Digital Surface Model (DSM)

1 height value per ground location

original image digital surface model

(color represents height)

35

Page 36: Camera Drones Lecture 3 3D data generation

Orthographic image projection

Orthoimage plane

Perspective image plane

Camera center

Perspective distortation

Terrain surface

36

Page 37: Camera Drones Lecture 3 3D data generation

Orthophoto generation

Orthoimage plane

Perspective image plane

Camera center

DSM

37

Page 38: Camera Drones Lecture 3 3D data generation

Orthophoto example

A true orthophoto has all perspective effects removed

original image true orthophoto

38