pyvista.Plotter.get_image_depth

pyvista.Plotter.get_image_depth#

Plotter.get_image_depth(
fill_value: float | None = nan,
reset_camera_clipping_range: bool = True,
) pyvista_ndarray[source]#

Return a depth image representing current render window.

Changed in version 0.47: The last image depth is no longer autoatically stored. You must enable store_image_depth=True within Plotter.show() to obtain the image depth after the pyvista.Plotter has been closed.

Parameters:
fill_valuefloat, default: numpy.nan

Fill value for points in image that do not include objects in scene. To not use a fill value, pass None.

reset_camera_clipping_rangebool, default: True

Reset the camera clipping range to include data in view.

Returns:
pyvista.pyvista_ndarray

Image of depth values from camera orthogonal to image plane.

Notes

Values in image_depth are negative to adhere to a right-handed coordinate system.

Examples

>>> import pyvista as pv
>>> pl = pv.Plotter()
>>> actor = pl.add_mesh(pv.Sphere())
>>> pl.show(store_image_depth=True)
../../../_images/pyvista-Plotter-get_image_depth-61df35fe924da5a4_00_00.png
>>> zval = pl.get_image_depth()