CentralCamera.decomposeH#
- CentralCamera.decomposeH(H: ndarray, K: ndarray | None = None) tuple[SE3, list[ndarray]][source]#
Decompose homography matrix
- Parameters:
H (ndarray(3,3)) – homography matrix
K (ndarray(3,3), optional) – camera intrinsics, defaults to parameters from object
- Returns:
camera poses, plane normals
- Return type:
SE3, list of ndarray(3,1)
Decomposes the homography matrix into the camera motion and the normal to the plane. In practice, there are multiple solutions. The translation not to scale.
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); >>> H, resid = CentralCamera.points2H(p1, p2) >>> T, normals = camera1.decomposeH(H) >>> T.printline(orient="camera") >>> normals (array([[ 0.1968], [ 0.0978], [-0.9756]]), array([[-0.1968], [-0.0978], [ 0.9756]]), array([[-0.9552], [-0.01 ], [-0.2958]]), array([[0.9552], [0.01 ], [0.2958]]))
- References:
P. Corke, Robotics, Vision & Control for Python, Springer, 2023, Section 14.2.4.
- Seealso: