Egomotion Code Example Usage

[Go back to the main page]

  • f is the focal length, in pixels
  • pp.x and pp.y are the distance of the principal point from the upper left corner of the image, again in pixels
(Note: 1000 correspondence distributions are quick and accurate enough to give visually appealing results. Nevertheless, our results on images with ground truth motion suggest that using more distributions continues to improve motion estimates.)
An example of usage:

>> swim8 = imread('swim8.pgm');
>> swim9 = imread('swim9.pgm');
>> f = 447.6;
>> pp.x=132.4;pp.y=96.9;
>> matches = getmatches(swim9,swim8,1000,0); % (this takes 19 seconds)
gabor filtering...
 [--------------------------------------------------]
doing points...
 [--------------------------------------------------]
>> motionparams = motion(matches,f,pp,1);     % (this takes 68 seconds)
sampling motion space
[----------------------------------------          ]
nonlinear searches
[--------------------------------------------------]
score:146.355849
tx: -0.266020  ty: -0.005455  tz: 0.963952  rx: 0.000115  ry: -0.004001  rz: -0.000980
>> plot_ep_lines(swim9,swim8,f,pp,motionparams)