FundamentalStructure From Motion Примеры с cv2.imshow требуют сборки OpenCV с GUI. В ноутбуке с headless-версией используйте вывод изображений через Matplotlib.
Computes Absolute or Exterior Orientation (Pose Estimation) between 2 sets of 3D point.
Get Essential matrix from Fundamental and Camera matrices.
Get Essential matrix from Motion (R's and t's ).
Get Essential matrix from Fundamental and Camera matrices.
Get Fundamental matrix from Projection matrices.
Estimate the fundamental matrix between two dataset of 2D point (image coords space).
Normalizes the Fundamental matrix.
Get projection matrices from Fundamental matrix.
Computes the relative camera motion between two cameras.
Function Documentation
computeOrientation()
#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.
essentialFromFundamental()
#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: [120] 9.6 pag 257 (formula 9.12)
essentialFromRt()
#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.
fundamentalFromEssential()
#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: [120] 9.6 pag 257 (formula 9.12) or http://ai.stanford.edu/~birch/projective/node20.html
fundamentalFromProjections()
#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()
#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: [120] 9.6 pag 259 (Result 9.19)
motionFromEssentialChooseSolution()
#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.
normalizedEightPointSolver()
#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: [120] 11.2 pag.281 (x1 = x, x2 = x')
normalizeFundamental()
#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()
#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()
#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.
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.
Reference: [120] 9.6 pag 257 (formula 9.12)
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 [120] 9.6 pag 259 (9.6.3 Geometrical interpretation of the 4 solutions).
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}\)