3

I tried determining camera motion from fundamental matrix using opencv. I'm currently using optical flow to track movement of points in every other frame. Essential matrix is being derived from fundamental matrix and camera matrix. My algorithm is as follows

1 . Use goodfeaturestotrack function to detect feature points from frame.

2 . Track the points to next two or three frames(Lk optical flow), during which calculate translation and rotation vectorsusing corresponding points

3 . Refresh points after two or three frame (use goodfeaturestotrack). Once again find translation and rotation vectors.

I understand that i cannot add the translation vectors to find the total movement from the beginning as the axis keep changing when I refresh points and start fresh tracking all over again. Can anyone please suggest me how to calculate the summation of movement from the origin.

  • If you have no rotation you should be able to add your translation vectors, if you have rotation, convert the vectors into a 3x4 pose matrix and multiply the matrices from each frame to get total change in pose. – Hammer Oct 25 '12 at 14:57
  • Thanks for the help !! Actually I do have rotation, Will try your suggestion. – madhu_kiran Nov 02 '12 at 12:24

2 Answers2

1

You are asking is a typical visual odometry problem. concatenate the transformation matrix SE3 of the Lie-Group. You just multiply the T_1 T_2 T_3 till you get T_1to3

You can try with this code https://github.com/avisingh599/mono-vo/blob/master/src/visodo.cpp

  for(int numFrame=2; numFrame < MAX_FRAME; numFrame++)
    if ((scale>0.1)&&(t.at<double>(2) > t.at<double>(0)) && (t.at<double>(2) > t.at<double>(1))) {

      t_f = t_f + scale*(R_f*t);
      R_f = R*R_f;

    }

Its simple math concept. If you feel difficult, just look at robotics forward kinematic for easier understanding. Just the concatenation part, not the DH algo. https://en.wikipedia.org/wiki/Forward_kinematics

Dr Yuan Shenghai
  • 1,849
  • 1
  • 6
  • 19
0

write all of your relative camera position in a 4x4 transformation matrix and then multiply each matrix one after another. For example:

Frame 1 location with respect to origin coordinate system = [R1 T1]

Frame 2 location with respect to Frame 1 coordinate system = [R2 T2]

Frame 3 location with respect to Frame 2 coordinate system = [R3 T3]

Frame 3 location with respect to origin coordinate system = [R1 T1] * [R2 T2] * [R3 T3]

Derza Arsad
  • 41
  • 1
  • 2