Example

advertisement

Example

• A camera translates to its right (in the positive X direction) by 

1 m, and down (in the positive Y direction) by 0.5 m.  

– Give the 3x3 essential matrix that relates these two views.

• The essential matrix is  E = [ t ] x

R ,  where

• [ t ] x is the skew symmetric matrix  corresponding to  t

• t is the translation of camera 2 with  respect to camera 1; i.e.,  c1 P c2org

• R is rotation of camera 2 with respect to  camera 1; i.e.,  c1 c2

R

EGGN 512  Computer Vision    Colorado School of Mines, Engineering Division      Prof. William Hoff

1

Example

• Assume that a point is observed at image location (0.3, 0.1) in the second  image, where these are “normalized” image coordinates (such that  effective focal length is equal to 1).  Accurately draw the corresponding  epipolar line in the first image, on the graph below.

-1.0

-0.5

-1.0

-0.5

0.5

1.0

+y

0.5

1.0

+x

EGGN 512  Computer Vision    Colorado School of Mines, Engineering Division      Prof. William Hoff

2

Example 

• Pick some points (by hand) from image 2; draw the corresponding epipolar lines on image 1

Data is from  http://perception.csl.uiuc.edu/ec e497ym/lab2.htm.

cube1.JPG

cube2.JPG

• Assume that we know the relative pose between the viewpoints.  The pose of  camera 2 with respect to camera 1 is c c

1

2

H

H_c2_c1 =    [ 0.939891 0.042845 ‐0.338777 0.972073;

‐0.070203 0.995150 ‐0.068912 0.217070;

0.334181 0.088553 0.938340 0.089186 ;

0.000000 0.000000 0.000000 1.000000 ];

Intrinsic camera parameter matrix is

K =  [ 655.3076   0  340.3110;

0  653.5052  245.3426;

0         0    1.0000];

3

EGGN 512  Computer Vision    Colorado School of Mines, Engineering Division      Prof. William Hoff

clear all close all

K = [ 655.3076 0 340.3110;

0 653.5052 245.3426;

0 0 1.0000];

I1 = imread( 'cube1.jpg' ); imshow(I1, []), impixelinfo;

I2 = imread( 'cube2.jpg' ); figure, imshow(I2, []), impixelinfo;

H_c2_c1 = [

0.939891 0.042845 -0.338777 0.972073;

-0.070203 0.995150 -0.068912 0.217070;

0.334181 0.088553 0.938340 0.089186 ;

0.000000 0.000000 0.000000 1.000000 ];

Pc2org_c1 = H_c2_c1(1:3,4);

R_c2_c1 = H_c2_c1(1:3,1:3);

% Calculate essential matrix t = Pc2org_c1;

E = [ 0 -t(3) t(2); t(3) 0 -t(1); -t(2) t(1) 0] * R_c2_c1;

% Draw epipolar lines p2 = [

312 311 312;

51 243 423;

1 1 1]; pn2 = inv(K) * p2;

EGGN 512  Computer Vision    Colorado School of Mines, Engineering Division      Prof. William Hoff

4

for i=1:size(pn2, 2) figure(2); hold on plot(p2(1,i), p2(2,i), 'r*' ); figure(1);

% The product l=E*p2 is the equation of the epipolar line corresponding

% to p2, in the first image. Here, l=(a,b,c), and the equation of the

% line is ax + by + c = 0.

l = E * pn2(:,i);

% Let's find two points on this line. First set x=-1 and solve

% for y, then set x=1 and solve for y.

R = 1; pLine0 = [-1; (-l(3)-l(1)*(-1))/l(2); 1]; pLine1 = [1; (-l(3)-l(1))/l(2); 1];

% Convert from normalized to unnormalized coords pLine0 = K * pLine0; pLine1 = K * pLine1; end line([pLine0(1) pLine1(1)], [pLine0(2) pLine1(2)], 'Color' , 'r' ); pause

EGGN 512  Computer Vision    Colorado School of Mines, Engineering Division      Prof. William Hoff

5

Download