pysdic.compute_pixel_integration_points#

compute_pixel_integration_points(mesh, camera, *, warp_by=None, mask=None)[source]#

Compute the material points of a surface mesh seen by the pixels of a camera, as integration points of the mesh.

  1. The (deformed) mesh is projected on the sensor, and the pixels whose center is inside a projected element are selected (see compute_projected_mesh_mask()).

  2. The material point seen by each selected pixel is computed, according to the dimension \(E\) of the world points of the camera (the dimension of the mesh):

    The pixels that see no point of the mesh are discarded.

The natural coordinates of the points are valid for any displacement of the mesh (same connectivity), e.g. to follow the material points seen at a frame to another frame.

Important

The case \(E = 3\) requires the optional package open3d (pip install open3d). The case \(E = 2\) has no optional dependency.

Parameters:
  • mesh (pysdic.Mesh) – The surface mesh (with an element type), of dimension \(E = 2\) or \(3\) 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 of the vertices (name of a vertex property or array of shape \((N_v, E)\)), e.g. the displacement of a frame of an analysis.

  • mask (Optional[ArrayLike], optional) – A boolean mask of shape \((H, W)\) or \((H \times W,)\) restricting the pixels to use (e.g. a region of interest). By default, all the pixels inside the projected mesh.

Returns:

  • integration_points (pysdic.IntegrationPoints) – One located point per pixel seeing the mesh, in row-major order of the pixels.

  • pixel_points (numpy.ndarray) – The pixel indices (row, column) of the points, of shape \((N_p, 2)\) and integer dtype.

Raises:
  • TypeError – If an input has a wrong type.

  • ValueError – If the mesh is not a surface mesh of dimension 2 or 3, its dimension is not the input dimension of the camera, or the extrinsic of the camera cannot be inverted (\(E = 2\)).

Return type:

Tuple[IntegrationPoints, ndarray]