Una Scena Contiene Tre Figure Giacenti Su Tre Piani Paralleli

Total Page:16

File Type:pdf, Size:1020Kb

Una Scena Contiene Tre Figure Giacenti Su Tre Piani Paralleli

Prova in itinere 1 del 2005 (05-first)

Exercise 3

A scen e contain s three shape s lying on three parallel plane s ; the shape s are two identi c a l parallelogra m s (the angle bet w e e n the direc tion s is  and 90-  ), and a “cro s s ” compo s e d by two segmen t s with an angle  . For each of the two parallelogr a m s you see in the image only three edges, but the cros s is complet e l y visible. Can you determin ed the

β

Φ α β-Φ 0

Φ

α-Φ

Φ

With six points you can compute 3 cross-ratios on the scene from the cross ratios in the image. tan tan( )  tan r  1 tan tan( )  tan  tan  tan  r  2 tan( )  tan tan( )  tan   tan  tan  r  3 tan  tan tan  tan 

These three equations in three unknowns allow to compute α,β,Φ , and solve the problem (every direction on the infinite line can be determined.

Exercise 1 (05-first) We want to develop a method similar to the Hough tran sfor m for finding circ u m f e r e n c e s in an image a) Choose a parameter space b) Determine how an image point transforms in the chosen parameter space. c) We want to reduce the dimensionality of the transform of an image point belonging to the circle contour by expoliting the following: i. the gradient at the contour points can be computed ii. the approximate constraint (to be explained) relating the contour and gradient directions. How does a contour point transform, then?

Solution

The Hough space is determined by parameters ρ and the center Consider a point belonging to the circumference and determine its transform in the Hough space:

2 2 2 (x  xc )  (y  yc )   Is the circumference equation, where xc yc and ρ are fixed, whereas x and y do change.

2 2 2 (xc  x)  (yc  y)   where x and y are fixed, whereas xc yc and ρ change

Therefore a point (x,y) belonging to C in the image space is a circle C* in the parameter space.

C*’s center belongs to the line passing through (x,y).

ρ determines the radius of circle C*.

This leads to a cone-like surface: ρ

y c

x c

The information about the gradient allows to determine the line on which the circumference center lies.

x,y xc  x    g g yc  y So we know that: x  x x x c  g  y  y  g x  x c  c  x ,y yc  y y g y g c c

So we find the equation of a line r

ρ

When ρ varies in the parameter space this line determines a plane. y c The intersection between the plane passing r x through the cone center and the cone is a c couple of lines.

C. Exercise (060201) A point w i s e light sour c e at position S=[1,0,0], light s a lamberti a n plane at coordina t e Z=3. The scen e is imaged by a camer a whos e calibra tion 1 0 0 2 2 2 P  0 1 2 2 . 2 2 0  1 2 2 Determin e the image point corre s ponding to the most illumin a t e d point.. Chara c t e r iz e the iso- inten s i t y (i.e., cons t a n t irradian c e ) curve s on the Write the equation of one of thes e curve s . . z

S  1,0,0 d x r

y  Z=3

The most illumin a t e d point is the neare s t one to the light sourc e, at carte s i a n coordin a t e s Max:[1, 0, 3]. Its image is P. Max_omog, where The iso- illumin a t e d curve s of the lamberti a n plane are circu m f e r e n c e s center ed at [1,0]. You must write the matri x C repre s e n t i ng a generi c circu m f e r e n c e . Then, consid er that that circu m f e r e n c e is define on the So, an homograph y exi s t s bet w e e n the plane containi ng the circu m f e r e n c e and the image plane. This homography is NOT the subm a tri x M of the proje c t ion matri x P (bec au s e M does not depend on the plane). Howe v e r , that homography is comput ed from the proje c t io n You write down the vector of homogeneou s coordin a t e s of the generi c point as [x, y, 3t. t], then premultipl y that vector with the matri x P; the result is equival e n d to a reduc ed (3x3) matri x H for the vector [x,y,t]. In the end, the image of a generic circumference C is C’=H -T C H-1. B. Exercise (060201) Derive a procedur e for calibra t ing a cam er a from a single image of a . Sinc e the cam er a is not natural, three vani s h ing point s along orthogonal direct ion s are not enough.. You can for exa mpl e compute two omographi e s transfor m i ng the bottom square base into its image, and the upper square base to its image

V’ 90 V’ β V 90 V ’45 V β V V’ 45 0

V 0

D ∞

C

The cross ratio can be B computed by considering that in the scene the vanishing point along the diagonal is at 45° w.r.t. The cross ratio allows to compute any generic point on the A considered plane.

For any image point p we consider two separate interpretations: a) Image of a point P1 on the plane of the bottom base b) Image of a point P2 on the plane of the top base.

Image plane

P2

P1

For each of P1 and P2, thanks to the determined homographies, the spatial coordinates in the scene can be computed The coordinates allow to determine the direction P1P2, which is the direction of the interpretation line of point p. So, the camera is calibrated. Tema d’esame appello (050218) Exercise C (050218) A perspective camera has the following calibration matrix:   1 0 0 2   2 2  P  0 1  2 2   2 2  0  1   2 2  A parallelogram (A,B,C,D) with the AB edge parallel to DC and BC edge parallel to AD. The parallelogram image has vertexes (A’,B’,C’,D’) with coordinates A’:[-2,-1], B’:[-1,0], C’:[1,0] e D’: [3,-2]. 1) Determine AD’s direction, AB’s direction and angle  between them; 2) Determine the ratio between the base AD and height (AB sin  ) of the parallelogram.

1) This is the image of the parallelogram:

0 V1   1  7 1 1 V2   0 B'  C'     0  0

 2 A'  1  3  D'   2

In order to compute AB’s direction we exploit the parallelism between edges AB and DC. The intersection between their lines represents the vanishing point, and the interpretation line of the vanishing point has the direction we are looking for.

1 Direction of the interpretation lined1  M V1 1 d 2  M V2 In order to find M-1 you must invert P, sin c e P = [ M | m]

  1 0 0    0  0  0 1 2 2 1       M  0   d  M  1  0  0  2 2  1        2 2  1  2 1 0   2 2 

V1’s last element in homogeneous coordinates is 1

   7       7  50  7     1   2  2  d 2  M  0         2   2 50   1       2  2      2   2 50 

normalization

T T d1  d 2 d1  d 2 2 2 cos    sin  1 cos 2   1  0,99 1 d1  d 2 2 50 4 50

1 since we already normalized

2) In order to find the ratio bet w e e n base AD and height s AB sin  an image plane parallel to the object plane would be really and length ratios would be kept (but not absolute lengths). You must build the rectified image obtained by reprojecting the image on a convenient plane: this plane is any plane parallel to the object plane.

You pick the plane on which both directions d1 and d2 lie, and you find the normal to that. In other words, you are looking for the vector product of the two directions.

d z d z  d1  d 2 then you normalize d z  d z The next step is picking two directions on which the new reference xyz will be built.

Reusing d1 and d2 is convenient because they are already  .

You then consider d x  d1 . This way you have two orthogoal directions dx and dz. If

you picked dy as the third original direction, that would be problematic because the perpendicularity between directions would not be ensured. The third direction is then

found as the vector product of the two directions found so far: d y  d x  d z . In order to transform A’ (image of the original point) a A’’ (image of the reconstructed point) you build a new, virtual camera.

 f 0 0   K' 0 f 0 P' K' R K't  M '| m' 0 0 1  f 0 0 0  R t  A0 f 0 0   T  0 1 0 0 1 0

Move and rearrange f is conveniently set the camera to 1

The projection matrix transforming the original reference into the new one, with axes x and y parallel to the object plane (so it’s straightened) is:

 T  d x  T  R  d y   T  d  z  now you must check how A’ is transformed in the new image point. infinite point along OAA’ (more convenient)

T T 1 0 0d  d d '  x   x A  d A ' d A '   T T A'' P'  M '| m'  M 'd ' K' Rd ' 0 1 0 d d ' d d '  A''  0   0  A A   y A y A      T   T  0 0 1 d d d '   z   z A 

A’’, image of A on a more convenient plane We chose this because it’s a virtual camera

The cartesian point coordinates can now be retrieved

d x  d A ' d y  d A ' X A '' YA '' d z  d A ' d z  d A '

Similarly you compute B’’, C’’ e D’’. At the end, compute distance between A and B in order to find AB and distance between A and D to find AD; then compute the required ratio AD / (AB sin ). D. (050218) A cylinder with radiou s 1 is trunc a e d by two circ ul a r sec t ion perpendi c u l a r to its axi s, at dista n c e 2. The cylinder is imaged by a non calibra t e d cam er a : its image is a pair of coni c s C1 and C2 (image s of the circul a r sect ion s ) and by two rectilin e a r bitangen t segme n t s (tangent to both coni c s ) . Des c rib e a procedur e for calibra t ing the cam er a , based on the cylinder image. A camer a is calibra t e d when its proje c t ion matri x P is kno w n – that is, when each point on the image plane can be asso c i a t e d to its interpret a t i on line w.r.t. a referen c e frame center ed on the cylinder.

Solution

Observa t ion: in order to recon s t r u c t the two base s of the cylinder, you onlyne ed five point s on the coni c in the image. Sinc e the cam er a is not natural, we must kno w more than just three orthogonal vanis h ing points. Let’s find the vani s hi ng point s in the cylinder image: Describe how the vanishing points are found:

c V 90

b V α

a V 0

d V α+90 Compute the cros s ratio in the image: d  b a  b  r d  c a  c

C∞

Cros s ratio in the scen e:

A  C

B  C B A  D B  D

A 1 1  tg 1 tg  tg  1 tg 2

D V d 90 Sinc e the cros s ratio is kept, by cons tr a i n i ng the equalit y you can find α: D ∞   arctan( 1 r )

Now consider a generi c point on the infinite line, repre s e t i n g a generi c V c C direct ion β: β B Vα b β A V a 0 Cros s ratio in the image: a  c b  c  r a  d b  d

Cros s ratio in the scen e:

A  C  tg B  C  A  D tg  tg

B  D Which allo w s to determin e β as function of r computed in the image.

This finds the direc tion (expre s s e d using an angle β) of a generi c point coplan ar to the circu m f e r e n c e . In order to determin e a spec ifi c point the distan c e ρ from the center must be comput ed.

d V β D ∞

ρ C c R B

A b a Cros s ratio in the image: a  c b  c  r a  d b  d

Cros s ratio in the scen e: A  C  B  C   r A  D   R B  D

Which lead s to:

rR   r 1

Observe that a generi c camer a is calibra t ed if for each pixel the interpret a t i on line is kno w n Image plane 1 cos 1   sin    1 1  2  Sin c e

d  M 1 u ρ pi 1 Where β 1 i=1..4

and u pi are the point coordinates d The directions of four pixels are sufficient in β 2 ρ order to 2 calibrate the camera

 2 cos  2   sin    2 2  0 

Note: when matrix M is found, K can be computed by RT decomposition, which expresses M as te product between an orthogonal and an upper triangular matrix. By RT decomposing the inverse of M you find the rotation matrix and then the triangular matrix. By inverting the obtained product, you obtain at first an upper triangular matrix (which is K), then the rotation matrix.

If the camera was natural, you could calibrate that by just using three orthogonal vanishing points

f 0 u0

K  0 f v0 0 0 1 V 90

If you have 3 orthogonal directions you can enforce that their scalar product is 0.

2  1 0  u0  1   K T K 1  0 1  v 2 f 2  0   2 2 2 2 2   u0  v0 f  v0  u0 V   α

V 0 u is the vanishing point coordinate in the image.

T T 1 ua K K u90  0 T T 1 ua K K u0  0 T T 1 u0 K K u90  0

V V apice 90

V 0

V apice

From this system of equation you determine v0,u0 and f The three direction in the scene will be orthogonal. Two orthogonal directions are found on on the symmetry plane on which the symmetry axis and camera center lie. The third direction is orthogonal to these two – and normal to the plane.

Recommended publications