pysdic.compute_projected_elements_areas#

compute_projected_elements_areas(mesh, camera, *, warp_by=None, signed=False)[source]#

Compute the area in pixels² of the projection of each element of a surface mesh (\(K = 2\)) on the sensor of a camera.

The area is integrated with the Gauss points of the element type:

\[A_e = \sum_g w_g \left| \det \left( J_P(\vec{X}_g) \, J_X(\vec{\xi}_g) \right) \right|\]

where \(J_X = \frac{\partial \vec{X}}{\partial \vec{\xi}}\) of shape \((E, 2)\) is the Jacobian of the element (see pysdic.fem.compute_jacobian_matrix()) and \(J_P = \frac{\partial \vec{x}_i}{\partial \vec{X}}\) of shape \((2, E)\) the Jacobian of the projection (see pysdic.Camera.project()). The perspective, the distortion and the curved elements are taken into account.

Note

The occlusions are not taken into account: a hidden element has a projected area (see compute_visibility()). Elements projected out of the sensor also have an area.

Parameters:
  • mesh (pysdic.Mesh) – A surface mesh with an element type, of dimension \(E\) equal to the input dimension of the camera.

  • camera (Union[pysdic.Camera, pysdic.View]) – The camera (or a view, whose camera is used).

  • warp_by (Optional[Union[str, ArrayLike]], optional) – The displacement added to the vertices: the name of a vertex property or an array of shape \((N_v, E)\).

  • signed (bool, optional (default: False)) – If True, the determinant is not taken in absolute value: the sign gives the orientation of the projected element (its sense of rotation in the image compared with the reference element), e.g. to detect the elements seen from the back.

Returns:

An array of shape \((N_e,)\) with the projected area of each element in pixels² (NaN if the projection of a Gauss point is not finite).

Return type:

numpy.ndarray

Raises:
  • TypeError – If mesh or camera has a wrong type.

  • ValueError – If the mesh is not a surface mesh with an element type, or if its dimension is not the input dimension of the camera.