N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):...

33
N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y): 2

Transcript of N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):...

Page 1: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

N=M=30

What is an image?

Image is a 2D rectilinear array of pixels (picture element)N=M=256

f(x,y):2

Page 2: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

L=15(4 bits)L=255 (8 bits)

What is an image?No continuous values - Quantization

[ , ] :[1, ] [1, ] [0, ]f x y N M L

255

170

15

8

L=1 (1 bit) L=3 (2 bits)

Page 3: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

An image is just 2D?No! – It can be in any dimensionExample 3D:

Voxel-Volume Element

Page 4: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

An image is just 2D?No! – It can be in any dimensionAn image is a n-dimensional rectilinear array of elements

1 2[ ] :[1, ] [1, ] ...[1, ] [0, ]nf x N N N L

[ ] :[1, ] [0, ]nf x N L

f x: n

Page 5: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

Does an image just map to scalars?

[ ] :[1, ] [1, ]n nf x N Lf x: n n

Page 6: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

Roy van Pelt, PhD & Anna Vilanova, PhDTU/e Biomedical Image Analysis Group, 2012

Page 7: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

Sampling and Quantization

• Sampling is digitizing the coordinate values of our function, e.g., f(x,y).

• Quantization is digitizing the amplitude values.

• In practice the sampling and quantization depend on the sensor arrangement that does the measurements.

Page 8: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

A B

Page 9: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

Digital vs Continuous Image

mm(11.25,11.25) [5,5]f f ( , ) [ , ]f i x j y f i j

Is the distance in mm between samples in x direction

is the distance in mm between samples in y direction

x

yy

xy

x

Spatial resolution defines the smallest spatial change that we will be able to distinguish, in spatial units!

Measures for that are dots per unit distance dpi, e.g., (dots per inch).

Page 10: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

Contrast

• Dynamic range is lowest and highest intensity level that an image shows

• Contrast is the difference in intensity between the highest and the lowest level.

• High Dynamic range implies high contrast• Intensity resolution smallest discernible change in

intensity level. – Usually integer power of 2, measured by number of bits.– Whether you can distinguish all levels or not depends on

human perception.

Page 11: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

False Contouring

Page 12: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

Image Interpolation

• We use the data we know to estimate the values in unknown positions.

x

( )f x [ ] ( ) ( )f i f x f x

x?

Page 13: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

Image Interpolation–Nearest Neighbour

• We use the data we know to estimate the values in unknown positions.

x

( )f x [ ] ( ) ( )f i f x f x

? x

0.5 [ ]( )

[ 1]

xi

x

xi f i

f x xf i

else

Page 14: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

Example How does it work in 2D?

Page 15: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

Image Interpolation – Linear Interpolation

• We use the data we know to estimate the values in unknown positions.

x

( )f x [ ] ( ) ( )f i f x f x

?

( ) (1 ) 1

x x i xi t

x x

f x f i t f i t

x

Page 16: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

ExampleHow does it work in 2D?

Page 17: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

Interpolation

• There are other methods for interpolation of higher order. Meaning more neighbors are involved and more complex curves are fitted.

Page 18: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

Transformations

Page 19: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

19

Motivation

How can we transform images?Apply transformation to all pixelsFirst do translation, then rotation, then scaling

tSRvv

Page 20: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

20

Motivation

• Transformation in 2D

• Transformation using homogenous coordinatestSRvv

110012221

1211

y

x

taa

taa

y

x

y

x

Page 21: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

21

Homogenous coordinates

• Allow to manipulate n-dim vectors in a n+1-dim space

• A point p can be written as vector • In homogenous coordinates we add a scaling factor

• To transform the homogenous coordinates in normal coordinate, divide by the n+1 coordinate.

y

xp

1

y

x

w

wy

wx

ph

Page 22: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

22

Homogenous coordinates

• we note

• Proof:

11

:, y

x

by

x

aba

1/

/

/

1

y

x

aa

aay

aax

a

ay

ax

y

x

a

Page 23: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

23

Translation

• Classic • Homogenous coordinates

y

x

tyy

txx

12

12

1

1

1

100

10

01

1

2

2

y

x

ty

tx

y

x

Page 24: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

24

Rotation (clockwise)

• Classic • Homogenous coordinates

1)cos(1)sin(

1)sin(1)cos(

2

2

yaxay

yaxax

1

1

1

100

0)cos()sin(

0)sin()cos(

1

2

2

y

x

aa

aa

y

x

Page 25: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

25

Translation and rotation

• Classic • Homogenous coordinates

tyyaxay

txyaxax

1)cos(1)sin(

1)sin(1)cos(

2

2

1

1

1

100

)cos()sin(

)sin()cos(

1

2

2

y

x

tyaa

txaa

y

x

Page 26: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

26

Translation, rotation and scaling

• Classic • Homogenous coordinates

tyyasyxasxy

txyasyxasxx

1)cos(1)sin(

1)sin(1)cos(

2

2

1

1

1

100

)cos()sin(

)sin()cos(

1

2

2

y

x

tyasyasx

txasyasx

y

x

Page 27: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

Affine Transformation

x2

y2

1

a11 a12 tx

a21 a22 ty

0 0 1

x1

y1

1

A transformation that preserves lines and parallelism (maps parallel lines to parallel lines) is an affine transformation.

Page 28: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

• Demonstration

Page 29: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

29

Rigid Transformations in 3d

• Around x-axis (counter-clockwise)

• Around y-axis• Around z-axis

• General

Rx (a)

1 0 0 0

0 cos(a) sin(a) 0

0 sin(a) cos(a) 0

0 0 0 1

Ry (b)

cos(b) 0 sin(b) 0

0 1 0 0

sin(b) 0 cos(b) 0

0 0 0 1

Rz(c)

cos(c) sin(c) 0 0

sin(c) cos(c) 0 0

0 0 1 0

0 0 0 1

T R

tx

ty

tz0 0 0 1

,R Rz(c)Ry (b)Rx (a)

Page 30: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

30

Image transformation

For each position Pd in the destination image we searchthe pixel color I(Pd).

Source image Destination image

Tsd

Page 31: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

31

Image transformation

First we compute a position Ps in the source image.

Source image Destination image

Tsd

1100

)cos()sin(

)sin()cos(

1d

d

yyx

xyx

s

s

y

x

tasas

tasas

y

x

Page 32: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

32

Image transformation

• P is not integer.• How do we compute I(Pd)=I(Ps)?• Answer: by interpolation

Ps0 Ps1

Ps3Ps2

Ps

Pd

Tsd

Page 33: N=M=30 What is an image? Image is a 2D rectilinear array of pixels (picture element) N=M=256 f(x,y):  2

• Demonstration