CentralCamera.points2E#

CentralCamera.points2E(p1: ndarray, p2: ndarray, method: str | None = None, K: ndarray | None = None, **kwargs) ndarray | tuple[ndarray, ndarray][source]#

Essential matrix from points

Parameters:
  • P1 (ndarray(2,N)) – image plane points

  • P2 (ndarray(2,N)) – image plane points

  • method (str) – method, can be ‘ransac’ or ‘lmeds’

  • K (ndarray(3,3), optional) – camera intrinsic matrix, defaults to that of camera object

  • kwargs – additional arguments required for ‘ransac’ or ‘lmeds’ options

Returns:

essential matrix and optional inlier vevtor

Return type:

ndarray(3,3), ndarray(N, bool)

Compute the essential matrix from two sets of corresponding points. Each set of points is represented by the columns of the array p1 or p2.

Example:

>>> from machinevisiontoolbox import CentralCamera, mkgrid
>>> from spatialmath import SE3
>>> camera1 = CentralCamera(name="camera 1", f=0.002, imagesize=1000, rho=10e-6, pose=SE3.Tx(-0.1)*SE3.Ry(0.4))
>>> camera2 = CentralCamera(name="camera 2", f=0.002, imagesize=1000, rho=10e-6, pose=SE3.Tx(0.1)*SE3.Ry(-0.4))
>>> T_grid = SE3.Tz(1) * SE3.Rx(0.1) * SE3.Ry(0.2)
>>> P = mkgrid(3, 1.0, pose=T_grid)
>>> p1 = camera1.project_point(P)
>>> p2 = camera2.project_point(P);
>>> E, inliers = camera1.points2E(p1, p2)
>>> E
array([[-0.    ,  0.2754,  0.    ],
       [ 0.2754, -0.    , -0.6513],
       [-0.    ,  0.6513, -0.    ]])
>>> inliers
array([ True,  True,  True,  True,  True,  True,  True,  True,  True])

Note

If the method is ‘ransac’ or ‘lmeds’ then a boolean array of inliers is also returned, True means the corresponding input point pair is an inlier.

Seealso:

E decomposeE opencv.findEssentialMat