pysdic.WorldPlaneOrthographicExtrinsic#
WorldPlaneOrthographicExtrinsic class#
- class WorldPlaneOrthographicExtrinsic(*args, **kwargs)[source]#
Bases:
WorldPlaneRigidExtrinsicSubclass of
pysdic.WorldPlaneRigidExtrinsicimplementing an orthographic camera observing the world plane \(Z_w = 0\).The 2D world points are transformed into the camera coordinate system by \(\vec{X}_c = A \vec{x}_w + T\) (see
pysdic.WorldPlaneRigidExtrinsic), and the normalized point is obtained by orthographic projection, i.e. by dropping the depth:\[\begin{split}\vec{x}_n = \begin{bmatrix} X_c \\ Y_c \end{bmatrix} = M \vec{x}_w + \vec{t} \quad \text{with} \quad M = R_{:2, :2}, \qquad \vec{t} = (t_x, t_y)^T\end{split}\]The transformation is an affine map of the plane, invertible as long as the plane is not seen edge-on: \(\det(M) = R_{22} \neq 0\) (cosine of the angle between the optical axis and the normal of the plane).
Note
As for
pysdic.OrthographicExtrinsic, the parameter \(t_z\) has no effect on the normalized points (its Jacobian is zero). It must be fixed in an optimization.See also
Class
pysdic.OrthographicExtrinsicfor the orthographic camera with 3D world points.
- Parameters:
parameters (Optional[ArrayLike], optional (default:
None)) – The extrinsic parameters as a 1D array of shape (6,). The first 3 elements represent the rotation vector \(\vec{r} = (r_x, r_y, r_z)\). The last 3 elements represent the translation vector \(T = (t_x, t_y, t_z)\).
Examples
A camera rotated by 90° around the \(z\) axis and translated along \(x\):
extrinsic = WorldPlaneOrthographicExtrinsic.from_rt( rvec=[0.0, 0.0, numpy.pi / 2], tvec=[1.0, 0.0, 5.0], ) extrinsic.apply([[1.0, 0.0]]).x # array([[1., 1.]]) extrinsic.invert([[1.0, 1.0]]).x # array([[1., 0.]])
Instantiation#
The WorldPlaneOrthographicExtrinsic class can be instantiated in three ways:
From a rotation and translation vector using the classmethod
from_rt().From a 4×4 transformation matrix using the classmethod
from_tmatrix().From a frame of reference using the classmethod
from_frame().
Create an extrinsic transformation from a 3D frame (convention 4). |
|
Create an extrinsic transformation from a rotation vector and a translation vector. |
|
Create an extrinsic transformation from a 4x4 transformation matrix. |
Implemented methods and attributes#
The following sections provide an overview of the attributes and methods defined
in the pysdic.WorldPlaneOrthographicExtrinsic class.
Attributes#
The extrinsic parameters can be accessed via the base class
pysdic.Transformation:
parameters: returns a vector of extrinsic parameters[rvec, tvec](the parameter \(t_z\) has no effect on the normalized points).
The pysdic.WorldPlaneOrthographicExtrinsic defines the following attributes:
[Get] the 3x3 homogeneous affine matrix between the world plane and the normalized plane. |
|
[Get/Set] the 3D frame of the extrinsic transformation. |
|
[Get/Set] the rotation matrix \(R\) of the extrinsic transformation. |
|
[Get/Set] the rotation vector \(\vec{r}\) of the camera. |
|
[Get/Set] the 4x4 transformation matrix of the extrinsic transformation. |
|
[Get/Set] the translation vector \(T\) of the camera. |
Performing Projections#
Use the apply and invert methods from
pysdic.Transformation to perform extrinsic projections:
apply: mapsworld_points(2D points of the plane \(Z_w = 0\)) →normalized_points.invert: mapsnormalized_points→world_points(intersection of the rays with the plane \(Z_w = 0\), no depth needed).compute_rays: mapsnormalized_points→rays(origins and unit directions in 3D world coordinates).
Jacobians with respect to the input points and extrinsic parameters
can be computed by enabling the dx and dp flags:
dx=True: compute ∂normalized_points / ∂world_pointsdp=True: compute ∂normalized_points / ∂extrinsic_parameters
Compute the transformation from 2D world points of the plane \(Z_w = 0\) to 2D normalized points. |
|
Compute the inverse transformation from 2D normalized points to 2D world points of the plane \(Z_w = 0\) (intersection of the camera rays with the plane). |
Compute the rays of the camera passing through the given normalized points. |