CentralCamera.points2F#
- static CentralCamera.points2F(p1: ndarray, p2: ndarray, method: str = '8p', residual: bool = True, seed: int | None = None, **kwargs) list[source]#
Estimate fundamental matrix from corresponding points
- Parameters:
p1 (ndarray(2,N)) – image plane points from first camera
p2 (ndarray(2,N)) – image plane points from second camera
method (str, optional) – algorithm ‘7p’, ‘8p’ [default], ‘ransac’, ‘lmeds’
kwargs – optional arguments as required for ransac’, ‘lmeds’ methods
- Returns:
fundamental matrix and residual
- Return type:
ndarray(3,3), float
Computes the fundamental matrix from two sets of corresponding image-plane points. Corresponding points are given by corresponding columns of
p1andp2.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); >>> F, resid = CentralCamera.points2F(p1, p2) >>> F array([[-0.0001, 0.0005, -0.2083], [-0.0006, -0. , 0.2645], [ 0.3044, -0.3069, 1. ]]) >>> resid np.float64(2.2567392544778285e-06)
- Seealso: