pysdic.PlanarHomographicExtrinsic._apply#
- PlanarHomographicExtrinsic._apply(world_points, *, dx=False, dp=False)[source]#
Compute the transformation from 2D world points to 2D normalized points.
\[x_n = \frac{h_{00} x_w + h_{01} y_w + h_{02}}{w}, \qquad y_n = \frac{h_{10} x_w + h_{11} y_w + h_{12}}{w}, \qquad w = h_{20} x_w + h_{21} y_w + 1\]The Jacobian with respect to the world points is:
\[\begin{split}\frac{\partial \vec{x}_n}{\partial \vec{x}_w} = \frac{1}{w} \begin{bmatrix} h_{00} - x_n h_{20} & h_{01} - x_n h_{21} \\ h_{10} - y_n h_{20} & h_{11} - y_n h_{21} \end{bmatrix}\end{split}\]The Jacobian with respect to the parameters \((h_{00}, h_{01}, h_{02}, h_{10}, h_{11}, h_{12}, h_{20}, h_{21})\) is:
\[\begin{split}\frac{\partial \vec{x}_n}{\partial \vec{p}} = \frac{1}{w} \begin{bmatrix} x_w & y_w & 1 & 0 & 0 & 0 & -x_n x_w & -x_n y_w \\ 0 & 0 & 0 & x_w & y_w & 1 & -y_n x_w & -y_n y_w \end{bmatrix}\end{split}\]- Parameters:
world_points (numpy.ndarray) – Input 2D points in world coordinates. Shape
(n_points, 2).dx (bool, optional (default:
False)) – If True, compute the Jacobian with respect to the input world points.dp (bool, optional (default:
False)) – If True, compute the Jacobian with respect to the homography parameters.
- Returns:
normalized_points (numpy.ndarray) – Transformed 2D points in the normalized coordinate system. Shape
(n_points, 2).jacobian_dx (Optional[numpy.ndarray]) – Jacobian with respect to world points. Shape
(n_points, 2, 2)ifdx=True, otherwiseNone.jacobian_dp (Optional[numpy.ndarray]) – Jacobian with respect to the homography parameters. Shape
(n_points, 2, 8)ifdp=True, otherwiseNone.
- Raises:
ValueError – If the projective denominator \(w\) is zero for at least one point.
- Return type: