Mathematics of the Simple Camera

Preview:

DESCRIPTION

Mathematics of the Simple Camera. Overview. Simple Camera Scenes with spheres COP on +z COP = Centre Of Projection. Simple Camera (Cross Section). COP = Centre Of Projection. Y. d. y max. Z. -Z. COP. y min. View From the Camera. (x max , y max ). (x min , y min ). - PowerPoint PPT Presentation

Citation preview

1

Mathematics of the Simple Camera

2

OverviewOverview

Simple CameraSimple Camera– Scenes with spheresScenes with spheres– COP on +zCOP on +z

COP = Centre Of Projection

3

Simple Camera Simple Camera (Cross Section)(Cross Section)

Z -Z

Yd

COP

ymax

ymin

COP = Centre Of Projection

4

View From the CameraView From the Camera

(xmin, ymin)

(xmax, ymax)

5

Forming the RaysForming the Rays

Map screen pixels (M by N window) Map screen pixels (M by N window) to points in camera view planeto points in camera view plane

(0,0)

(M-1, N-1)

(xmin, ymin)

(xmax, ymax)

6

Forming the RaysForming the Rays

Consider pixel i,jConsider pixel i,j It corresponds to a rectangle It corresponds to a rectangle

width = (xmax-xmin)/Mwidth = (xmax-xmin)/M

height = (ymax-ymin)/Nheight = (ymax-ymin)/N

Our ray goes through the centre of the Our ray goes through the centre of the pixelpixel

Thus the ray goes through the pointThus the ray goes through the point

(xmin + width*(i+0.5), ymin + height*(j+0.5), 0.0)(xmin + width*(i+0.5), ymin + height*(j+0.5), 0.0)

7

Forming the RaysForming the Rays

Thus the ray from the COP Thus the ray from the COP through pixel i,j is defined bythrough pixel i,j is defined by

p(t) = (x(t), y(t), z(t)) = p(t) = (x(t), y(t), z(t)) =

((t*(xmin + width*(i+0.5)),t*(xmin + width*(i+0.5)),

t*(ymin + height*(j+0.5)),t*(ymin + height*(j+0.5)),

d - t*d)d - t*d)

8

Ray CastingRay Casting

Intersection of Sphere and line (sphere at origin)

Substitute the ray equation in the sphere equation and solve!

Get an equation in t of the form At2 + 2Bt + C = 0

9

Ray CastingRay Casting

If BIf B2 2 – AC < 0 then the ray doesn’t intersect – AC < 0 then the ray doesn’t intersect the sphere. the sphere.

If BIf B2 2 -AC = 0 the ray is tangent to the sphere-AC = 0 the ray is tangent to the sphere

If BIf B2 2 – AC > 0 then there are two roots given – AC > 0 then there are two roots given by by

t = (-B t = (-B (B(B22 – AC))/A – AC))/A

chose the lowest value one (the one closest chose the lowest value one (the one closest to the COP)to the COP)

10

Ray CastingRay Casting

Intersection of Sphere and line Intersection of Sphere and line (general case)(general case)– Sphere is centred at (a,b,c)Sphere is centred at (a,b,c)– Translate the start of the ray by (-a,-Translate the start of the ray by (-a,-

b,-c)b,-c)– Proceed as beforeProceed as before

11

The Image - Detection The Image - Detection

12

ConclusionsConclusions

We can now draw imagesWe can now draw images– Forming rays from the cameraForming rays from the camera– Intersecting those rays with objects (spheres) Intersecting those rays with objects (spheres)

in the scenein the scene ButBut

– No colour – merely binary detection No colour – merely binary detection operationoperation

– Camera is static - at the moment we must Camera is static - at the moment we must move the objects in front of the camera to be move the objects in front of the camera to be able to see themable to see them

– Need more interesting scenes!Need more interesting scenes!

Recommended