pysdic.PlanarHomographicExtrinsic._invert#
- PlanarHomographicExtrinsic._invert(normalized_points, *, dx=False, dp=False)[source]#
Compute the inverse transformation from 2D normalized points to 2D world points.
The inverse transformation is the homography of matrix \(G = H^{-1}\):
\[\begin{split}\begin{bmatrix} a \\ b \\ d \end{bmatrix} = G \begin{bmatrix} x_n \\ y_n \\ 1 \end{bmatrix}, \qquad x_w = \frac{a}{d}, \qquad y_w = \frac{b}{d}\end{split}\]The Jacobian with respect to the normalized points has the same form as for
applywith the coefficients of \(G\) and the denominator \(d\):\[\begin{split}\frac{\partial \vec{x}_w}{\partial \vec{x}_n} = \frac{1}{d} \begin{bmatrix} g_{00} - x_w g_{20} & g_{01} - x_w g_{21} \\ g_{10} - y_w g_{20} & g_{11} - y_w g_{21} \end{bmatrix}\end{split}\]The Jacobian with respect to the parameters is obtained by differentiating the identity \(T(T^{-1}(\vec{x}_n; \vec{p}); \vec{p}) = \vec{x}_n\) with respect to \(\vec{p}\):
\[\frac{\partial T^{-1}}{\partial \vec{p}}(\vec{x}_n) = - \frac{\partial \vec{x}_w}{\partial \vec{x}_n} \cdot \frac{\partial T}{\partial \vec{p}}(\vec{x}_w)\]where \(\frac{\partial T}{\partial \vec{p}}\) is the Jacobian of
applywith respect to the parameters evaluated at the world points \(\vec{x}_w\).- Parameters:
normalized_points (numpy.ndarray) – Input 2D points in normalized coordinates. Shape
(n_points, 2).dx (bool, optional (default:
False)) – If True, compute the Jacobian with respect to the input normalized points.dp (bool, optional (default:
False)) – If True, compute the Jacobian with respect to the homography parameters.
- Returns:
world_points (numpy.ndarray) – Inverse-transformed points in world coordinates. Shape
(n_points, 2).jacobian_dx (Optional[numpy.ndarray]) – Jacobian with respect to normalized 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 \(d\) is zero for at least one point.
- Return type: