| OpenCV 3.4.7 Open Source Computer Vision

Functions
Fundamental
Structure From Motion

## Functions
void | cv::sfm::computeOrientation (InputArrayOfArrays x1, InputArrayOfArrays x2, OutputArray R, OutputArray t, double s)
| Computes Absolute or Exterior Orientation (Pose Estimation) between 2 sets of 3D point. More...
void | cv::sfm::essentialFromFundamental (InputArray F, InputArray K1, InputArray K2, OutputArray E)
| Get Essential matrix from Fundamental and Camera matrices. More...
void | cv::sfm::essentialFromRt (InputArray R1, InputArray t1, InputArray R2, InputArray t2, OutputArray E)
| Get Essential matrix from Motion (R's and t's ). More...
void | cv::sfm::fundamentalFromEssential (InputArray E, InputArray K1, InputArray K2, OutputArray F)
| Get Essential matrix from Fundamental and Camera matrices. More...
void | cv::sfm::fundamentalFromProjections (InputArray P1, InputArray P2, OutputArray F)
| Get Fundamental matrix from Projection matrices. More...
void | cv::sfm::motionFromEssential (InputArray E, OutputArrayOfArrays Rs, OutputArrayOfArrays ts)
int | cv::sfm::motionFromEssentialChooseSolution (InputArrayOfArrays Rs, InputArrayOfArrays ts, InputArray K1, InputArray x1, InputArray K2, InputArray x2)
void | cv::sfm::normalizedEightPointSolver (InputArray x1, InputArray x2, OutputArray F)
| Estimate the fundamental matrix between two dataset of 2D point (image coords space). More...
void | cv::sfm::normalizeFundamental (InputArray F, OutputArray F_normalized)
| Normalizes the Fundamental matrix. More...
void | cv::sfm::projectionsFromFundamental (InputArray F, OutputArray P1, OutputArray P2)
| Get projection matrices from Fundamental matrix. More...
void | cv::sfm::relativeCameraMotion (InputArray R1, InputArray t1, InputArray R2, InputArray t2, OutputArray R, OutputArray t)
| Computes the relative camera motion between two cameras. More...

## Detailed Description

## Function Documentation

## § computeOrientation()

void cv::sfm::computeOrientation | ( | InputArrayOfArrays | x1,
|  | InputArrayOfArrays | x2,
|  | OutputArray | R,
|  | OutputArray | t,
|  | double | s
| ) |  |

`#include <opencv2/sfm/fundamental.hpp>`

Computes Absolute or Exterior Orientation (Pose Estimation) between 2 sets of 3D point.

Parameters

  x1 | Input first 3xN or 2xN array of points.
  x2 | Input second 3xN or 2xN array of points.
  R | Output 3x3 computed rotation matrix.
  t | Output 3x1 computed translation vector.
  s | Output computed scale factor.

Find the best transformation such that xp=projection*(s*R*x+t) (same as Pose Estimation, ePNP). The routines below are only for the orthographic case for now.

## § essentialFromFundamental()

void cv::sfm::essentialFromFundamental | ( | InputArray | F,
|  | InputArray | K1,
|  | InputArray | K2,
|  | OutputArray | E
| ) |  |

`#include <opencv2/sfm/fundamental.hpp>`

Get Essential matrix from Fundamental and Camera matrices.

Parameters

  F | Input 3x3 fundamental matrix.
  K1 | Input 3x3 first camera matrix \(K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\).
  K2 | Input 3x3 second camera matrix. The parameters are similar to K1.
  E | Output 3x3 essential matrix.

Reference: [84] 9.6 pag 257 (formula 9.12)

## § essentialFromRt()

void cv::sfm::essentialFromRt | ( | InputArray | R1,
|  | InputArray | t1,
|  | InputArray | R2,
|  | InputArray | t2,
|  | OutputArray | E
| ) |  |

`#include <opencv2/sfm/fundamental.hpp>`

Get Essential matrix from Motion (R's and t's ).

Parameters

  R1 | Input 3x3 first camera rotation matrix.
  t1 | Input 3x1 first camera translation vector.
  R2 | Input 3x3 second camera rotation matrix.
  t2 | Input 3x1 second camera translation vector.
  E | Output 3x3 essential matrix.

Reference: [84] 9.6 pag 257 (formula 9.12)

## § fundamentalFromEssential()

void cv::sfm::fundamentalFromEssential | ( | InputArray | E,
|  | InputArray | K1,
|  | InputArray | K2,
|  | OutputArray | F
| ) |  |

`#include <opencv2/sfm/fundamental.hpp>`

Get Essential matrix from Fundamental and Camera matrices.

Parameters

  E | Input 3x3 essential matrix.
  K1 | Input 3x3 first camera matrix \(K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\).
  K2 | Input 3x3 second camera matrix. The parameters are similar to K1.
  F | Output 3x3 fundamental matrix.

Reference: [84] 9.6 pag 257 (formula 9.12) or http://ai.stanford.edu/~birch/projective/node20.html

## § fundamentalFromProjections()

void cv::sfm::fundamentalFromProjections | ( | InputArray | P1,
|  | InputArray | P2,
|  | OutputArray | F
| ) |  |

`#include <opencv2/sfm/fundamental.hpp>`

Get Fundamental matrix from Projection matrices.

Parameters

  P1 | Input 3x4 first projection matrix.
  P2 | Input 3x4 second projection matrix.
  F | Output 3x3 fundamental matrix.

## § motionFromEssential()

void cv::sfm::motionFromEssential | ( | InputArray | E,
|  | OutputArrayOfArrays | Rs,
|  | OutputArrayOfArrays | ts
| ) |  |

`#include <opencv2/sfm/fundamental.hpp>`

Get Motion (R's and t's ) from Essential matrix.

Parameters

  E | Input 3x3 essential matrix.
  Rs | Output vector of 3x3 rotation matrices.
  ts | Output vector of 3x1 translation vectors.

Reference: [84] 9.6 pag 259 (Result 9.19)

## § motionFromEssentialChooseSolution()

int cv::sfm::motionFromEssentialChooseSolution | ( | InputArrayOfArrays | Rs,
|  | InputArrayOfArrays | ts,
|  | InputArray | K1,
|  | InputArray | x1,
|  | InputArray | K2,
|  | InputArray | x2
| ) |  |

`#include <opencv2/sfm/fundamental.hpp>`

Choose one of the four possible motion solutions from an essential matrix.

Parameters

  Rs | Input vector of 3x3 rotation matrices.
  ts | Input vector of 3x1 translation vectors.
  K1 | Input 3x3 first camera matrix \(K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\).
  x1 | Input 2x1 vector with first 2d point.
  K2 | Input 3x3 second camera matrix. The parameters are similar to K1.
  x2 | Input 2x1 vector with second 2d point.

Decides the right solution by checking that the triangulation of a match x1–x2 lies in front of the cameras. Return index of the right solution or -1 if no solution.

Reference: See [84] 9.6 pag 259 (9.6.3 Geometrical interpretation of the 4 solutions).

## § normalizedEightPointSolver()

void cv::sfm::normalizedEightPointSolver | ( | InputArray | x1,
|  | InputArray | x2,
|  | OutputArray | F
| ) |  |

`#include <opencv2/sfm/fundamental.hpp>`

Estimate the fundamental matrix between two dataset of 2D point (image coords space).

Parameters

  x1 | Input 2xN Array of 2D points in view 1.
  x2 | Input 2xN Array of 2D points in view 2.
  F | Output 3x3 fundamental matrix.

Uses the normalized 8-point fundamental matrix solver. Reference: [84] 11.2 pag.281 (x1 = x, x2 = x')

## § normalizeFundamental()

void cv::sfm::normalizeFundamental | ( | InputArray | F,
|  | OutputArray | F_normalized
| ) |  |

`#include <opencv2/sfm/fundamental.hpp>`

Normalizes the Fundamental matrix.

Parameters

  F | Input 3x3 fundamental matrix.
  F_normalized | Output 3x3 normalized fundamental matrix.

By default divides the fundamental matrix by its L2 norm.

## § projectionsFromFundamental()

void cv::sfm::projectionsFromFundamental | ( | InputArray | F,
|  | OutputArray | P1,
|  | OutputArray | P2
| ) |  |

`#include <opencv2/sfm/fundamental.hpp>`

Get projection matrices from Fundamental matrix.

Parameters

  F | Input 3x3 fundamental matrix.
  P1 | Output 3x4 one possible projection matrix.
  P2 | Output 3x4 another possible projection matrix.

## § relativeCameraMotion()

void cv::sfm::relativeCameraMotion | ( | InputArray | R1,
|  | InputArray | t1,
|  | InputArray | R2,
|  | InputArray | t2,
|  | OutputArray | R,
|  | OutputArray | t
| ) |  |

`#include <opencv2/sfm/fundamental.hpp>`

Computes the relative camera motion between two cameras.

Parameters

  R1 | Input 3x3 first camera rotation matrix.
  t1 | Input 3x1 first camera translation vector.
  R2 | Input 3x3 second camera rotation matrix.
  t2 | Input 3x1 second camera translation vector.
  R | Output 3x3 relative rotation matrix.
  t | Output 3x1 relative translation vector.

Given the motion parameters of two cameras, computes the motion parameters of the second one assuming the first one to be at the origin. If T1 and T2 are the camera motions, the computed relative motion is \(T = T_2 T_1^{-1}\)