CentralCamera.points2C#
- static CentralCamera.points2C(P: ndarray, p: ndarray) tuple[ndarray, float][source]#
Estimate camera matrix from data points
- Parameters:
P (ndarray(3,N)) – calibration points in world coordinate frame
p (ndarray(2,N)) – calibration points in image plane
- Returns:
camera calibration matrix and residual
- Return type:
ndarray(3,4), float
Estimate the camera matrix \(\mat{C}\) determined by least squares from corresponding world
Pand image-planeppoints. Corresponding points are represented by corresponding columns ofPandp. Also returns the residual which is:\[\max | \mat{C}\mat{P} - \mat{p} |\]Example:
>>> from machinevisiontoolbox import CentralCamera, mkcube >>> P = mkcube(0.2) >>> camera_unknown = CentralCamera(f=0.015, rho=10e-6, imagesize=[1280, 1024], noise=0.05, seed=0) >>> T_unknown = SE3.Trans(0.1, 0.2, 1.5) * SE3.RPY(0.1, 0.2, 0.3) >>> p = camera_unknown.project_point(P, objpose=T_unknown) >>> C, resid = CentralCamera.points2C(P, p) >>> C array([[ 852.8155, -233.0621, 633.5638, 740.0291], [ 222.9807, 990.0484, 294.836 , 711.964 ], [ -0.131 , 0.0655, 0.6488, 1. ]]) >>> camera_unknown.C() array([[1500., 0., 640., 0.], [ 0., 1500., 512., 0.], [ 0., 0., 1., 0.]]) >>> resid np.float64(0.0376726171853079)
Note
This method assumes no lens distortion affecting the image plane coordinates.
- References:
P. Corke, Robotics, Vision & Control for Python, Springer, 2023, Section 13.2.1.
- Seealso: