3D from Volume: Part III Dr. Francesco Banterle, - - PowerPoint PPT Presentation

3d from volume part iii
SMART_READER_LITE
LIVE PREVIEW

3D from Volume: Part III Dr. Francesco Banterle, - - PowerPoint PPT Presentation

3D from Volume: Part III Dr. Francesco Banterle, francesco.banterle@isti.cnr.it banterle.com/francesco The Processing Pipeline Enhancement Segmentation RAW Volume The Processing Pipeline Points Mesh Extractions Extraction 3D Mesh The


slide-1
SLIDE 1

3D from Volume: Part III

  • Dr. Francesco Banterle,

francesco.banterle@isti.cnr.it banterle.com/francesco

slide-2
SLIDE 2

The Processing Pipeline

Enhancement

RAW Volume

Segmentation

slide-3
SLIDE 3

The Processing Pipeline

Mesh Extraction Points Extractions

3D Mesh

slide-4
SLIDE 4

The Processing Pipeline

Mesh Extraction Points Extractions

3D Mesh

slide-5
SLIDE 5

3D Visualization

slide-6
SLIDE 6

Volume Visualization

  • We need to pre-visualize the 3D model that we are

going to create.

  • Pre-visualization is typically fast (no need to create

a 3D model) and helps the segmentation process.

slide-7
SLIDE 7

Volume Visualization

Camera Volume

slide-8
SLIDE 8

Camera Model: Pinhole Camera

world-space image-space

Yc Xc Zc f

Image Plane Hole

Yw Xw Zw

C

slide-9
SLIDE 9

Camera Model

  • Perspective projection:

M =     x y z 1     m0 =      x0 = −f · x

z

y0 = −f · y

z

z0 = −f

slide-10
SLIDE 10

Camera Model

  • Perspective projection:

Homogenous coordinates M =     x y z 1     m0 =      x0 = −f · x

z

y0 = −f · y

z

z0 = −f

slide-11
SLIDE 11

Camera Model: Pinhole Camera

Yc Xc Zc f

Image Plane Hole

u v

C c0

slide-12
SLIDE 12

Camera Model: Image Plane

u v c0 = [u0, v0]> = C0

  • Pixels have different height and width; i.e., (ku, kv).
  • c0 is called the principal point.
slide-13
SLIDE 13
  • If we take all into account, we obtain:

Camera Model: Intrinsic Parameters

m0 =      x0 = −ku · f · x

z + u0

y0 = −kv · f · y

z + v0

z0 = −f m0 =   x0 y0 1  

slide-14
SLIDE 14
  • This can be expressed in a matrix form with a non-

linear projection:

Camera Model: Intrinsic Parameters

P =   −fku u0 −fkv v0 1   = K[I|0] K =   −fku u0 −fkv v0 1  

m = P · M m0 = m/mz

slide-15
SLIDE 15

Camera Model: Extrinsic Parameters

  • They define the pose of the camera; i.e., its orientation and

position in the world-space.

  • This is defined as geometry matrix G:
  • R is a 3x3 rotation matrix (orthogonal matrix with

determinant 1) —> 3 angles: yaw, pitch, and, roll

  • t is translation vector (3 components)

G = R t 1

slide-16
SLIDE 16

Camera Model

  • The full camera model including the camera pose

is defined as

  • P is 3x4 matrix with 11 independent parameters!

P = K[I|0]G = K[R|t] t =   t1 t2 t3   R =   r>

1

r>

2

r>

3

 

slide-17
SLIDE 17

Rendering

  • The idea is to create for each pixel a ray (origin and

direction) that is going to intersect the volume.

  • We will color the pixel if its ray intersect the volume.

Otherwise the pixel will be set to zero. f Volume C

slide-18
SLIDE 18

Rendering

  • The idea is to create for each pixel a ray (origin and

direction) that is going to intersect the volume.

  • We will color the pixel if its ray intersect the volume.

Otherwise the pixel will be set to zero. f Volume C

slide-19
SLIDE 19

Rendering

  • The idea is to create for each pixel a ray (origin and

direction) that is going to intersect the volume.

  • We will color the pixel if its ray intersect the volume.

Otherwise the pixel will be set to zero. f Volume C

slide-20
SLIDE 20

Volume Rendering: Ray-Marching

Volume boundary

slide-21
SLIDE 21

Volume Rendering: Ray-Marching

Volume boundary r = (o; ~ d)

slide-22
SLIDE 22

Volume Rendering: Ray-Marching

Volume boundary r = (o; ~ d) xi

slide-23
SLIDE 23

Volume Rendering: Ray-Marching

Volume boundary r = (o; ~ d) xi xf

slide-24
SLIDE 24

Volume Rendering: Ray-Marching

xi xf

slide-25
SLIDE 25

Volume Rendering: Ray-Marching

I[u, v] = Z xf

xi

T ✓ V (o[u, v] + ~ d[u, v] · t) ◆ dt T is called the transfer function

slide-26
SLIDE 26

Volume Rendering: Ray-Marching

xi xf d Intensity Thr2 Thr1

slide-27
SLIDE 27

Volume Rendering: Ray-Marching

xi xf d Intensity Thr2 Thr1

slide-28
SLIDE 28

Volume Rendering: Ray-Marching

xi xf d Intensity Thr2 First Thr1

slide-29
SLIDE 29

Volume Rendering: Ray-Marching Example

slide-30
SLIDE 30

Volume Rendering: Ray-Marching

xi xf d Intensity Thr1 Thr2 Average

slide-31
SLIDE 31

Volume Rendering: Ray-Marching

xi xf d Intensity Thr1 Thr2 Average

slide-32
SLIDE 32

Volume Rendering: Ray-Marching Example

slide-33
SLIDE 33

hang on! Volumes have intensity values not colors…

slide-34
SLIDE 34

Volume Rendering: Color Mapping

  • To improve visualization intensity values are

mapped to colors:

  • In between values are linearly interpolated.

0.5 0.1

slide-35
SLIDE 35

Volume Rendering: Let there be light

  • We can improve quality by adding light sources.
  • There are local (taking into account that light

bounces around) and global models.

  • For the sake of simplicity, we are interested in local

models only!

slide-36
SLIDE 36

Volume Rendering: Let there be light

  • A local model is a function computing radiance (L); i.e.,

the value for coloring the pixel using only local geometry information:

  • Point’s position.
  • Point’s normal.
  • Optical properties of the material at its position. The

intensity value of the volume (or its color encoding) in

  • ur case.
  • Light source’s position.
slide-37
SLIDE 37

Volume Rendering: Let there be light

  • A simple model assumes that the light source is

placed at infinite (e.g., the sun): ~ l x ~ nx

slide-38
SLIDE 38

Volume Rendering: Let there be light

  • A simple local model is the diffuse model that

assume light is locally reflected in all directions: x ~ l ~ nx

slide-39
SLIDE 39

Volume Rendering: Let there be light

  • The model is defined as
  • Note that:
  • needs to be normalized.
  • needs to be normalized.

L(x) = ⇡ · max(−~ nx ·~ l, 0) ~ nx ~ l

slide-40
SLIDE 40

Volume Rendering: Let there be light

  • The model is defined as
  • Note that:
  • needs to be normalized.
  • needs to be normalized.

L(x) = ⇡ · max(−~ nx ·~ l, 0) ~ nx ~ l Radiance

slide-41
SLIDE 41

Volume Rendering: Let there be light

  • The model is defined as
  • Note that:
  • needs to be normalized.
  • needs to be normalized.

L(x) = ⇡ · max(−~ nx ·~ l, 0) ~ nx ~ l Albedo/Intensity Radiance

slide-42
SLIDE 42

Volume Rendering: Let there be light

slide-43
SLIDE 43

Volume Rendering: Let there be light

slide-44
SLIDE 44

Volume Rendering

  • It is a very simple and easy to implement method.
  • It is computationally expensive.
  • It works in real-time using a GPU!
slide-45
SLIDE 45

3D Points Extraction

slide-46
SLIDE 46

3D Points Extraction

  • For each slice of the volume, we compute the

edges of the segmented region:

slide-47
SLIDE 47

3D Points Extraction

  • For each white pixel in the edge with coordinates

(u,v) at the i-th slice, we compute its 3D position as m =   x y z   =   u · ku v · kv i · kw  

ku is the pixel’s width in mm kv is the pixel’s height in mm kw is the distance between slices in mm

slide-48
SLIDE 48

3D Points Extraction

  • How do we compute the normal at the point?
  • It is simply the negative value of the gradient of the

volume in that point! ~ rV

slide-49
SLIDE 49 140 10 20 20 120 40 30 100 60 40 80 50 80 60 100 60 70 120 80 40 140 90 20 100 110

3D Points Extraction Example

slide-50
SLIDE 50

3D Mesh Extraction

slide-51
SLIDE 51

A Very Stupid Algorithm:

For each extracted point, create a cube…

slide-52
SLIDE 52

A Very Stupid Algorithm Example

slide-53
SLIDE 53

A Very Stupid Algorithm Example

slide-54
SLIDE 54

A Very Stupid Algorithm Example

slide-55
SLIDE 55

I guess, we can do better than this!

slide-56
SLIDE 56

Connecting the dots…

slide-57
SLIDE 57

Edges Triangulation

  • As the first step, we extract the edges from each

slice in the volume.

  • We save the connectivity of points belonging to the

same edge —> “parametric curve”

  • We may have more curves per slice!
slide-58
SLIDE 58

Edges Triangulation

Slice 1 Slice 2

slide-59
SLIDE 59

Edges Triangulation

Z X Y

slide-60
SLIDE 60

Edges Triangulation

Z X Y

Find the nearest point in a previous slice

slide-61
SLIDE 61

Edges Triangulation

Z X Y

Connect with the next vertex in the upper line.

slide-62
SLIDE 62

Edges Triangulation

Z X Y

slide-63
SLIDE 63

Edges Triangulation

Z X Y

slide-64
SLIDE 64

Edges Triangulation: Fail Case

Slice 1 Slice 2

slide-65
SLIDE 65

Edges Triangulation: Fail Case

Slice 1 Slice 2

slide-66
SLIDE 66

Edges Triangulation: Fail Case

Slice 1 Slice 2

slide-67
SLIDE 67

Edges Triangulation

  • It works because we have a previously known

connectivity.

  • It works only for a binary segmentation mask. No

multiple objects!

  • Quality of triangles is pretty poor!
  • We cannot close the mesh, i.e., it is not watertight.
slide-68
SLIDE 68

Marching Cubes

slide-69
SLIDE 69

Let’s start in 2D

slide-70
SLIDE 70

Marching Squares

f(x, y) = 0

slide-71
SLIDE 71

Marching Squares

f(x, y) = 0

slide-72
SLIDE 72

Marching Squares

slide-73
SLIDE 73

Marching Squares

f(x, y) = 0

slide-74
SLIDE 74

Marching Squares

slide-75
SLIDE 75

Marching Squares

slide-76
SLIDE 76

Marching Squares

slide-77
SLIDE 77

Marching Squares: Cases

There are in total 16 (24) configurations, the

  • ther ones can be computed by rotating or

reflecting these.

slide-78
SLIDE 78

Marching Squares

  • 1st pass: For each square (“we march”):
  • We determine if it is fully inside (1) or outside the

curve (0).

  • 2nd pass: For each square:
  • We compute the configuration of the current square.
  • We fetch from the table of configurations our case.
  • We place the line for that case in the current square.
slide-79
SLIDE 79

Marching Squares Example

slide-80
SLIDE 80

Marching Squares Example

slide-81
SLIDE 81

Marching Squares Example

slide-82
SLIDE 82

Marching Squares Example

slide-83
SLIDE 83

Marching Squares Example

slide-84
SLIDE 84

Marching Squares Example

slide-85
SLIDE 85

Marching Squares Example

slide-86
SLIDE 86

Marching Squares Example

slide-87
SLIDE 87

Marching Squares Example

slide-88
SLIDE 88

Marching Squares Example

slide-89
SLIDE 89

Let’s move into the 3D world

slide-90
SLIDE 90

Marching Cubes

  • 1st pass: as in the 2D cases, we need to mark

which part of the volume is the inside (1) or the

  • utside (0).
  • 2nd pass: for each voxel, we need to find out the

current configuration and to look up into a table to place triangles!

slide-91
SLIDE 91

Marching Cubes

  • In 3D the look up table has 256 entries (28).
  • However, there are only 14 main cases (others are

computed by reflecting and/or rotating these):

slide-92
SLIDE 92

Marching Cubes

slide-93
SLIDE 93

Marching Cubes: Ambiguous Cases

Hole

[Cignoni et al. 1999]

slide-94
SLIDE 94

Marching Cubes: Ambiguous Cases

  • We have ambiguous cases at saddle points.
  • 1
45 40
  • 0.8
35 5
  • 0.6
30 10 25 15
  • 0.4
20 20 25 15
  • 0.2
30 10 35 5 40 45 0.2 0.4 0.6 0.8 1
slide-95
SLIDE 95

Marching Cubes: Ambiguous Cases

?

slide-96
SLIDE 96

Marching Cubes: Ambiguous Cases

  • A typical solution is to compute the saddle point for

each face of the a current cube.

  • Based on the sign of each face, we need to extend

the existing cases…

slide-97
SLIDE 97

Marching Cubes: Ambiguous Cases

  • A solution, which avoids ambiguous cases, is to

partition each voxel/cell into tetrahedra; e.g. 5 or 6

  • f them.
  • in the middle of the

– – –

slide-98
SLIDE 98

Marching Cubes: Ambiguous Cases

slide-99
SLIDE 99

Marching Cubes

  • Advantages:
  • Easy to understand and to implement.
  • Fast and non memory consuming.
  • Very robust.
slide-100
SLIDE 100

Marching Cubes

  • Disadvantages:
  • Consistency: Guarantee a C0 and manifold result:

ambiguous cases.

  • Correctness: return a good approximation of the real

surface

  • Mesh complexity: the number of triangles does not

depend on the shape of the isosurface (but on the discretization, i.e., number of voxels).

  • Mesh quality: arbitrarily ugly triangles.
slide-101
SLIDE 101

Poisson Reconstruction

slide-102
SLIDE 102

Poisson Reconstruction

  • The idea of this method is to reconstruct the

surface of a 3D model by solving for the indicator function of the shape: χ(p) = ( 1 if p ∈ M,

  • therwise.

1 1 1 1 1 1 1 1

slide-103
SLIDE 103

Poisson Reconstruction: Gradient Relationship

  • There is a relationship between the normal field

and gradient of indicator function:

Oriented Points Indicator function gradient

slide-104
SLIDE 104

Poisson Reconstruction: Integration as a Poisson Problem

  • Let’s represent the points with a normal by a vector

field .

  • We need to find a function whose gradients best

approximates : min

χ kr ~

V k χ ~ V ~ V

slide-105
SLIDE 105
  • If we apply the divergence operator, this becomes

a Poisson problem:

Poisson Reconstruction: Integration as a Poisson Problem

r · (r) = r · ~ V $ ∆ = r · ~ V min

χ kr ~

V k

slide-106
SLIDE 106

Poisson Reconstruction Example

slide-107
SLIDE 107

Poisson Reconstruction Example

slide-108
SLIDE 108

Poisson Reconstruction

  • Precise and robust.
  • Computationally slow, it depends on the resolution.
  • The Poisson solution needs to close stuff so if there

are no enough points in an area weird things will happen.

slide-109
SLIDE 109

that’s all folks!

slide-110
SLIDE 110

Acknowledgements

  • Some images on work by:
  • Dr. Fabio Ganovelli:
  • http://vcg.isti.cnr.it/~ganovell/
  • Dr. Paolo Cignoni:
  • http://vcg.isti.cnr.it/~cignoni/