Intro. KEssential Mat)l Fundamental Mat. I Epipolar Geom. I Corresp. I Reconst Recall in chapter 2 Combine rotations in 3 axes The camera has rotated ex, ay, ez rc brings a vector in world coordinates to the camera coordinates Y=R=RRRY 0 0 cos(0, )0 -sin(e, cos(0)sin(0)OX 0 cos(0,) sin(8,) 0 0 si()cos2)0‖y 0 -sin(0,)cos(0,)sin(e, )0 cos(0,) cos(e. cos(0 cole sin(e X cos(e. )sin(0, )sin (e, )-cos(0. )sin(0, )cos(0, )cos(e. )+sin(0, )sin (e, )sin(e ) cos(e, )sin(,)r, sin(e, sin(0 )+cos(e, ) cos(e ) sin(e )cos(e )sin(e, )sin (0 )-cos(e )sin (0. )cos(0, )cos(e, )[z Stereo vO. a
Intro. | Essential Mat. | Fundamental Mat. | Epipolar Geom. | Corresp. | Reconst. Recall in chapter 2: Combine rotations in 3 axes: The camera has rotated (x, y, z), Rc brings a vector in world coordinates to the camera coordinates • Stereo v0.a 16 ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) + − − + − − − − = = = w w w x z x z y x y z z x x y z x y x z x z x y z y x y z y z y w w w z z z z y y y y x x x x c c c w w w c x y z c c c Z Y X Z Y X Z Y X Z Y X R R R R Z Y X sin sin cos cos sin cos sin sin cos sin cos cos cos sin sin cos sin cos cos sin sin sin cos sin cos cos cos sin sin 0 0 1 sin( ) cos( ) 0 cos( ) sin( ) 0 sin( ) 0 cos( ) 0 1 0 cos( ) 0 sin( ) 0 sin( ) cos( ) 0 cos( ) sin( ) 1 0 0
Intro. KEssential Mat)l Fundamental Mat. I Epipolar Geom. I Corresp. I Reconst function demo stereo Demo stereo ppm=5 10A-6; %ppm=pixel_ _ per meter P1= > demo stereo 1.0e+005* Pw=[00,1/pm] f=5*10-3/ppm %f=focal length 0 0 2.000 %cam1 left(ref/world), cam2 right camera tc1=-0.1/ppm %translation of from world center to cam2 center,( to 2.0000 1.0e+004* ve dirl 080 06 tc2=0/ppm; tc3=0/ppm 1.0000e+003 Tc=[tc1, tc2, tc3] 1.6829 P2= Rc=rot(0,1,0) 2.0000e+004 1.0e+005* Pc=RC*(Pw-Tc%this forumla is used in chapter 2, camera model 1.5749 %‰%‰%‰%‰%%%%%%‰‰%%%%‰‰%%‰%%%% 2489 P1=Pw %Pw(in ch2, world coord. ) P1 is in world coord (in ch8) 054030-0.8415Pc 01.00000 1.0e+005* T=-Rc'Tc %Tc is a vector from cam1 center to cam2 center(by defn) 0.841500.5403 1.5749 %-Tc is the vector from cam2 center to cam1 center( in cam1 coord) %by defn Rc brings a vector in cam1 coord. to cam2 coord 1.0e+005* 1.2489 %T is the vector from cam2 center to cam1 center in the cam2 coords -15749 Tc is the vector from cam1 P2=Rc"P1+T%this is used in chapter 8 stereo %center to cam2 center(in cam1 cOol Pc %try to see the two formulas are same or not 1.2489 Tc is the vector from cam1 center to cam2 center (in cam1 coord) 1.0e+004 0 %so T is the vector from cam2 center to cam1 center in the cam2 ans %so t is the vector from cam2 center %to cam 1 center in the cam2 coords function Rc =rot(an x, an_ y, an_z, 1.0e+004* RZ=[cos(an z) sin(an z)0; -sin(an z) cos(an 2)0:00 1; 1.0806 ostan sin(an y); 0 10; sin(an y)0 cos(an y)]; Rx=[1 00; 0 cos(an_x)sin(an_x); 0-sin(an_x)cos(an_x)]; Stereo vo.a 1.6829
Intro. | Essential Mat. | Fundamental Mat. | Epipolar Geom. | Corresp. | Reconst. • function demo_stereo Demo_stereo1 • ppm=5*10^-6;%ppm=pixel_per_meter • Pw=[0,0,1/ppm]' • f=5*10^-3/ppm %f=focal length • %cam1 left(ref/world), cam2 right camera • tc1=-0.1/ppm %translation of from world center to cam2 center,(to - ve dir) • tc2=0/ppm; tc3=0/ppm • Tc=[tc1,tc2,tc3]'; • Rc=rot(0,1,0) • Pc=Rc*(Pw-Tc) %this forumla is used in chapter 2 , camera model • %%%%%%%%%%%%%%%%%%%%%%%%%%%%% • P1=Pw %Pw (in ch2, world coord.);P1 is in world coord (in ch8) • T=-Rc*Tc %Tc is a vector from cam1 center to cam2 center (by defn) • %-Tc is the vector from cam2 center to cam1 center (in cam1 coord) • %by defn , Rc brings a vector in cam1 coord. to cam2 coord. • %T is the vector from cam2 center to cam1 center in the cam2 coords. • P2=Rc*P1+T %this is used in chapter 8 stereo • Pc %try to see the two formulas are same or not P2 • 'Tc is the vector from cam1 center to cam2 center (in cam1 coord)' • Tc • '%so T is the vector from cam2 center to cam1 center in the cam2 coords. ' • T • function Rc =rot(an_x,an_y,an_z) • Rz=[cos(an_z) sin(an_z) 0; -sin(an_z) cos(an_z) 0; 0 0 1]; • Ry=[cos(an_y) 0 -sin(an_y); 0 1 0; sin(an_y) 0 cos(an_y)]; • Rx=[1 0 0;0 cos(an_x) sin(an_x); 0 -sin(an_x) cos(an_x)]; • Rc = Rx*Ry*Rz; Stereo v0.a 17 • >> demo_stereo2 • Pw = • 1.0e+005 * • 0 • 0 • 2.0000 • f = • 1.0000e+003 • tc1 = • -2.0000e+004 • tc3 = • 0 • Rc = • 0.5403 0 -0.8415 • 0 1.0000 0 • 0.8415 0 0.5403 • Pc = • 1.0e+005 * • -1.5749 • 0 • 1.2489 P1 = 1.0e+005 * 0 0 2.0000 T = 1.0e+004 * 1.0806 0 1.6829 P2 = 1.0e+005 * -1.5749 0 1.2489 Pc = 1.0e+005 * -1.5749 0 1.2489 ans = Tc is the vector from cam1 %center to cam2 center (in cam1 coord) Tc = 1.0e+004 * -2.0000 0 0 ans = %so T is the vector from cam2 center %to cam1 center in the cam2 coords. T = 1.0e+004 * 1.0806 0 1.6829
Intro. KEssential Mat) Fundamental Mat. I Epipolar Geom. I Corresp. | Reconst CMSC5711, Ch8 Stereo, Exercise1: X, is 3-D X in left camera(reference) system X, is 3-D X in right camera system 1 a)Draw vectors T×X2andT×X1 in the diagran Epipolar Geometry: Camera 1 at the reference world coordinates, camera 2 is at the camera coordinates 2=R米X1+T Plane-3 113 Left image is the reference/ Perpendicular to T×X2OrT×X1 (x2 y2)Right epipolar line Left epipolar line left (x1y) right frame Frame Plane-2 I Plane-1∏ O R e T(from O2 to O, in cam2 coordinates Focal Base line=lTll Focal Stereo vO. a 18 length=f, length-f2
Intro. | Essential Mat. | Fundamental Mat. | Epipolar Geom. | Corresp. | Reconst. CMSC5711, Ch8 Stereo, Exercise1:X1 is 3-D X in left camera (reference) system X2 is 3-D X in right camera system (1a) Draw vectors TX2 and TX1 in the diagram Epipolar Geometry: Camera 1 at the reference world coordinates, camera 2 is at the camera coordinates, X2=R*X1+T • X O2 O1 right Frame Plane-2 2 left Frame Plane-1 1 e1 e2 Left epipolar line Right epipolar line T (from O2 to O1 in cam2 coordinates) (x1 ,y1 ) (x2 ,y2 ) Left image is the reference Focal length=f1 Focal length=f2 Base line=||T|| Plane-3 3 Perpendicular to TX2 or TX1 R Stereo v0.a 18
Intro. KEssential Mat) Fundamental Mat. I Epipolar Geom. I Corresp. | Reconst Essential matrix E(a 3x3 matrix) P 110[2]X, is 3-DX in left camera(reference) system X, is 3-D X in right camera system Exercise 1b,1c 0 (1b)If T=[1 2 3, Write the matrix for [TIx (c) Write the sizes of the matrices X1:,X2:,R:,x:E [TI TB=TXTB by definition Set camera l is at the reference(or world)coordinates camera 2 is at the camera coodinates. (Note T and X2 are using cam2 as reference X2=RX, +T, multiply both sides by[ 2=TIRX-----( Because[TI, - XTB and T]=skew symmetricmatrix andTIT=TxT=0 Tand X, are on the same plane, X, is perpendicular to(TxX, sO X,(TxX,)=0, same as X,(TIx,)=0 X-F R"X+7 Plane from(),X2(TRX =0 Left image is the reference/ Perpendic T X, or T X (xxv)Right ep bipolar line Left epipolar line ence *e*X,=wHere E R left right Frame Frame Pane-2∏ Plane-I I Focally T(from O, to O, in cam2 coordinates Base line=Tll length=/ length=/2 Stereo vO. a 19
Intro. | Essential Mat. | Fundamental Mat. | Epipolar Geom. | Corresp. | Reconst. Essential matrix E (a 3x3 matrix) P.110[2] X1 is 3-D X in left camera (reference) system X2 is 3-D X in right camera system • [ ] by definition 0 0 0 [ ] 2 1 3 1 3 2 3 2 1 A x B A B x x T T T T t t t t t t t t t T = − − − = = E E T R (i) T R T T T T T T T T T T T T T R T T T T R i T T T T A B A B = = = = = = = = = = + = − − − − − hence * * 0,where from , ( ) 0 so X ( ) 0,same as X ( ) 0 and are on the same plane, is perpendicular to ( ) Because[ ] and skew symmetricmatrix and 0 ,multiply both sides by , ( ) camera 2 is at the camera coodinates.(Note :T and X2 are using cam2 as reference) Set camera1is at the reference (or world) coordinates. 2 1 2 1 2 2 2 2 2 2 2 2 1 2 1 Stereo v0.a 19 Exercise 1b,1c (1b) If T=[1 2 3]’, Write the matrix for [T]x (1c) Write the sizes of the matrices: X1:___,X2:__, R:___,T:___, [T]x :___,E:____ X2 T
Intro. KEssential Mat)l Fundamental Mat. I Epipolar Geom. I Corresp. I Reconst Essential Matrix(E) X1*E*X1=0 Y Z*E 0 no harm to prefix some constants f2 fi f2 X,YZ。*E f2]*E*[x1y1f=0--( since y Z=X Y and x (,,,i,(x2,,,2 are 3D points on left, right image planes resp Right image point*E*Left image point=0 Focal lengths f, f,of both cameras should be known here Stereo vO. a
Intro. | Essential Mat. | Fundamental Mat. | Epipolar Geom. | Corresp. | Reconst. Essential Matrix (E) Stereo v0.a 20 Focal lengths , of both camerasshould be known here Right_image_point * *L _image_point 0 are 3D points on left,right image planesresp. since X,and , * * 0 ( ) * * 0 No_harm_to_prefix_some_constants , * * 0 X * * 0 ( ) 1 2 T 1 1 1 2 2 2 2 2 2 1 1 1 1 1 1 1 1 2 2 2 2 2 1 1 2 2 2 2 2 1 1 1 1 T 2 f f E eft (x ,y ,f ) , (x ,y ,f ) Z Y y ZX X Y Z x x y f E x y f ii X Y Z Z f X Y Z E Z f Z f Z f X Y Z E X Y Z E X i T T T = = = = = − − − = = = − − − − − − •