Camera Class Reference

This class serves as the primary interface between the camera and the various features provided by the SDK. More...

Functions

None close (self)
 Close an opened camera. More...
 
ERROR_CODE open (self, py_init=InitParameters())
 Opens the ZED camera from the provided InitParameters. More...
 
bool is_opened (self)
 Reports if the camera has been successfully opened. More...
 
ERROR_CODE grab (self, RuntimeParameters py_runtime=RuntimeParameters())
 This method will grab the latest images from the camera, rectify them, and compute the measurements based on the RuntimeParameters provided (depth, point cloud, tracking, etc.) More...
 
ERROR_CODE retrieve_image (self, Mat py_mat, view=VIEW.LEFT, type=MEM.CPU, resolution=Resolution(0, 0))
 Retrieves images from the camera (or SVO file). More...
 
ERROR_CODE retrieve_measure (self, Mat py_mat, measure=MEASURE.DEPTH, type=MEM.CPU, resolution=Resolution(0, 0))
 Computed measures, like depth, point cloud, or normals, can be retrieved using this method. More...
 
ERROR_CODE set_region_of_interest (self, Mat py_mat, modules=[MODULE.ALL])
 Defines a region of interest to focus on for all the SDK, discarding other parts. More...
 
ERROR_CODE get_region_of_interest (self, Mat py_mat, resolution=Resolution(0, 0), module=MODULE.ALL)
 Get the previously set or computed region of interest. More...
 
ERROR_CODE start_region_of_interest_auto_detection (self, roi_param=RegionOfInterestParameters())
 Start the auto detection of a region of interest to focus on for all the SDK, discarding other parts. More...
 
REGION_OF_INTEREST_AUTO_DETECTION_STATE get_region_of_interest_auto_detection_status (self)
 Return the status of the automatic Region of Interest Detection The automatic Region of Interest Detection is enabled by using startRegionOfInterestAutoDetection. More...
 
ERROR_CODE start_publishing (self, CommunicationParameters communication_parameters)
 Set this camera as a data provider for the Fusion module. More...
 
ERROR_CODE stop_publishing (self)
 Set this camera as normal camera (without data providing). More...
 
None set_svo_position (self, int frame_number)
 Sets the playback cursor to the desired frame number in the SVO file. More...
 
int get_svo_position (self)
 Returns the current playback position in the SVO file. More...
 
int get_svo_number_of_frames (self)
 Returns the number of frames in the SVO file. More...
 
ERROR_CODE ingest_data_into_svo (self, SVOData data)
 ingest a SVOData in the SVO file. More...
 
list get_svo_data_keys (self)
 Get the external channels that can be retrieved from the SVO file. More...
 
ERROR_CODE retrieve_svo_data (self, str key, dict data, Timestamp ts_begin, Timestamp ts_end)
 retrieve SVO datas from the SVO file at the given channel key and in the given timestamp range. More...
 
ERROR_CODE set_camera_settings_range (self, VIDEO_SETTINGS settings, min=-1, max=-1)
 Sets the value of the requested camera setting that supports two values (min/max). More...
 
ERROR_CODE set_camera_settings_roi (self, VIDEO_SETTINGS settings, Rect roi, eye=SIDE.BOTH, reset=False)
 Overloaded method for VIDEO_SETTINGS.AEC_AGC_ROI which takes a Rect as parameter. More...
 
(ERROR_CODE, int) get_camera_settings (self, VIDEO_SETTINGS setting)
 Returns the current value of the requested camera setting (gain, brightness, hue, exposure, etc.). More...
 
(ERROR_CODE, int, int) get_camera_settings_range (self, VIDEO_SETTINGS setting)
 Returns the values of the requested settings for VIDEO_SETTINGS that supports two values (min/max). More...
 
ERROR_CODE get_camera_settings_roi (self, VIDEO_SETTINGS setting, Rect roi, eye=SIDE.BOTH)
 Returns the current value of the currently used ROI for the camera setting AEC_AGC_ROI. More...
 
bool is_camera_setting_supported (self, VIDEO_SETTINGS setting)
 Returns if the video setting is supported by the camera or not. More...
 
float get_current_fps (self)
 Returns the current framerate at which the grab() method is successfully called. More...
 
Timestamp get_timestamp (self, TIME_REFERENCE time_reference)
 Returns the timestamp in the requested TIME_REFERENCE. More...
 
int get_frame_dropped_count (self)
 Returns the number of frames dropped since grab() was called for the first time. More...
 
ERROR_CODE get_current_min_max_depth (self, float min, float max)
 Gets the current range of perceived depth. More...
 
CameraInformation get_camera_information (self, resizer=Resolution(0, 0))
 Returns the CameraInformation associated the camera being used. More...
 
RuntimeParameters get_runtime_parameters (self)
 Returns the RuntimeParameters used. More...
 
InitParameters get_init_parameters (self)
 Returns the InitParameters associated with the Camera object. More...
 
PositionalTrackingParameters get_positional_tracking_parameters (self)
 Returns the PositionalTrackingParameters used. More...
 
SpatialMappingParameters get_spatial_mapping_parameters (self)
 Returns the SpatialMappingParameters used. More...
 
ObjectDetectionParameters get_object_detection_parameters (self, instance_module_id=0)
 Returns the ObjectDetectionParameters used. More...
 
BodyTrackingParameters get_body_tracking_parameters (self, instance_id=0)
 Returns the BodyTrackingParameters used. More...
 
StreamingParameters get_streaming_parameters (self)
 Returns the StreamingParameters used. More...
 
ERROR_CODE enable_positional_tracking (self, py_tracking=PositionalTrackingParameters())
 Initializes and starts the positional tracking processes. More...
 
None update_self_calibration (self)
 Performs a new self-calibration process. More...
 
ERROR_CODE enable_body_tracking (self, BodyTrackingParameters body_tracking_parameters=BodyTrackingParameters())
 Initializes and starts the body tracking module. More...
 
None disable_body_tracking (self, int instance_id=0, bool force_disable_all_instances=False)
 Disables the body tracking process. More...
 
ERROR_CODE retrieve_bodies (self, Bodies bodies, BodyTrackingRuntimeParameters body_tracking_runtime_parameters=BodyTrackingRuntimeParameters(), int instance_id=0)
 Retrieves body tracking data from the body tracking module. More...
 
bool is_body_tracking_enabled (self, int instance_id=0)
 Tells if the body tracking module is enabled.
 
ERROR_CODE get_sensors_data (self, SensorsData py_sensors_data, time_reference=TIME_REFERENCE.CURRENT)
 Retrieves the SensorsData (IMU, magnetometer, barometer) at a specific time reference. More...
 
ERROR_CODE set_imu_prior (self, Transform transfom)
 Set an optional IMU orientation hint that will be used to assist the tracking during the next grab(). More...
 
POSITIONAL_TRACKING_STATE get_position (self, Pose py_pose, reference_frame=REFERENCE_FRAME.WORLD)
 Retrieves the estimated position and orientation of the camera in the specified reference frame. More...
 
PositionalTrackingStatus get_positional_tracking_status (self)
 Return the current status of positional tracking module. More...
 
AREA_EXPORTING_STATE get_area_export_state (self)
 Returns the state of the spatial memory export process. More...
 
ERROR_CODE save_area_map (self, area_file_path="")
 Saves the current area learning file. More...
 
None disable_positional_tracking (self, area_file_path="")
 Disables the positional tracking. More...
 
bool is_positional_tracking_enabled (self)
 Tells if the tracking module is enabled.
 
ERROR_CODE reset_positional_tracking (self, Transform path)
 Resets the tracking, and re-initializes the position with the given transformation matrix. More...
 
ERROR_CODE enable_spatial_mapping (self, py_spatial=SpatialMappingParameters())
 Initializes and starts the spatial mapping processes. More...
 
None pause_spatial_mapping (self, bool status)
 Pauses or resumes the spatial mapping processes. More...
 
SPATIAL_MAPPING_STATE get_spatial_mapping_state (self)
 Returns the current spatial mapping state. More...
 
None request_spatial_map_async (self)
 Starts the spatial map generation process in a non-blocking thread from the spatial mapping process. More...
 
ERROR_CODE get_spatial_map_request_status_async (self)
 Returns the spatial map generation status. More...
 
ERROR_CODE retrieve_spatial_map_async (self, py_mesh)
 Retrieves the current generated spatial map. More...
 
ERROR_CODE extract_whole_spatial_map (self, py_mesh)
 Extract the current spatial map from the spatial mapping process. More...
 
ERROR_CODE find_plane_at_hit (self, coord, Plane py_plane, parameters=PlaneDetectionParameters())
 Checks the plane at the given left image coordinates. More...
 
ERROR_CODE find_floor_plane (self, Plane py_plane, Transform reset_tracking_floor_frame, floor_height_prior=float('nan'), world_orientation_prior=Rotation(Matrix3f().zeros()), floor_height_prior_tolerance=float('nan'))
 Detect the floor plane of the scene. More...
 
None disable_spatial_mapping (self)
 Disables the spatial mapping process. More...
 
ERROR_CODE enable_streaming (self, streaming_parameters=StreamingParameters())
 Creates a streaming pipeline. More...
 
None disable_streaming (self)
 Disables the streaming initiated by enable_streaming(). More...
 
bool is_streaming_enabled (self)
 Tells if the streaming is running. More...
 
ERROR_CODE enable_recording (self, RecordingParameters record)
 Creates an SVO file to be filled by enable_recording() and disable_recording(). More...
 
None disable_recording (self)
 Disables the recording initiated by enable_recording() and closes the generated file. More...
 
RecordingStatus get_recording_status (self)
 Get the recording information. More...
 
None pause_recording (self, value=True)
 Pauses or resumes the recording. More...
 
RecordingParameters get_recording_parameters (self)
 Returns the RecordingParameters used. More...
 
ERROR_CODE enable_object_detection (self, object_detection_parameters=ObjectDetectionParameters())
 Initializes and starts object detection module. More...
 
None disable_object_detection (self, instance_module_id=0, force_disable_all_instances=False)
 Disables the object detection process. More...
 
ERROR_CODE retrieve_objects (self, Objects py_objects, ObjectDetectionRuntimeParameters object_detection_parameters=ObjectDetectionRuntimeParameters(), instance_module_id=0)
 Retrieve objects detected by the object detection module. More...
 
ERROR_CODE get_objects_batch (self, list[ObjectsBatch] trajectories, instance_module_id=0)
 Get a batch of detected objects. More...
 
ERROR_CODE ingest_custom_box_objects (self, list[CustomBoxObjectData] objects_in, instance_module_id=0)
 Feed the 3D Object tracking function with your own 2D bounding boxes from your own detection algorithm. More...
 
bool is_object_detection_enabled (self, int instance_id=0)
 Tells if the object detection module is enabled.
 

Static Functions

str get_sdk_version ()
 Returns the version of the currently installed ZED SDK. More...
 
list[DevicePropertiesget_device_list ()
 List all the connected devices with their associated information. More...
 
list[StreamingPropertiesget_streaming_device_list ()
 Lists all the streaming devices with their associated information. More...
 
ERROR_CODE reboot (int sn, bool full_reboot=True)
 Performs a hardware reset of the ZED 2 and the ZED 2i. More...
 

Detailed Description

This class serves as the primary interface between the camera and the various features provided by the SDK.

It enables seamless integration and access to a wide array of capabilities, including video streaming, depth sensing, object tracking, mapping, and much more.

A standard program will use the Camera class like this:

import pyzed.sl as sl
def main():
# --- Initialize a Camera object and open the ZED
# Create a ZED camera object
zed = sl.Camera()
# Set configuration parameters
init_params = sl.InitParameters()
init_params.camera_resolution = sl.RESOLUTION.HD720 # Use HD720 video mode for USB cameras
# init_params.camera_resolution = sl.RESOLUTION.HD1200 # Use HD1200 video mode for GMSL cameras
init_params.camera_fps = 60 # Set fps at 60
# Open the camera
err = zed.open(init_params)
if err != sl.ERROR_CODE.SUCCESS:
print(repr(err))
exit(-1)
runtime_param = sl.RuntimeParameters()
# --- Main loop grabbing images and depth values
# Capture 50 frames and stop
i = 0
image = sl.Mat()
depth = sl.Mat()
while i < 50 :
# Grab an image
if zed.grab(runtime_param) == sl.ERROR_CODE.SUCCESS: # A new image is available if grab() returns SUCCESS
# Display a pixel color
zed.retrieve_image(image, sl.VIEW.LEFT) # Get the left image
err, center_rgb = image.get_value(image.get_width() / 2, image.get_height() / 2)
if err == sl.ERROR_CODE.SUCCESS:
print("Image ", i, " center pixel R:", int(center_rgb[0]), " G:", int(center_rgb[1]), " B:", int(center_rgb[2]))
else:
print("Image ", i, " error:", err)
# Display a pixel depth
zed.retrieve_measure(depth, sl.MEASURE.DEPTH) # Get the depth map
err, center_depth = depth.get_value(depth.get_width() / 2, depth.get_height() /2)
if err == sl.ERROR_CODE.SUCCESS:
print("Image ", i," center depth:", center_depth)
else:
print("Image ", i, " error:", err)
i = i+1
# --- Close the Camera
zed.close()
return 0
if __name__ == "__main__":
main()
Definition: sl.pyx:1

Functions

◆ close()

None close (   self)

Close an opened camera.

If open() has been called, this method will close the connection to the camera (or the SVO file) and free the corresponding memory.

If open() wasn't called or failed, this method won't have any effect.

Note
If an asynchronous task is running within the Camera object, like save_area_map(), this method will wait for its completion.
To apply a new InitParameters, you will need to close the camera first and then open it again with the new InitParameters values.
Warning
If the CUDA context was created by open(), this method will destroy it.
Therefore you need to make sure to delete your GPU sl.Mat objects before the context is destroyed.

◆ open()

ERROR_CODE open (   self,
  py_init = InitParameters() 
)

Opens the ZED camera from the provided InitParameters.

The method will also check the hardware requirements and run a self-calibration.

Parameters
py_init: A structure containing all the initial parameters. Default: a preset of InitParameters.
Returns
An error code giving information about the internal process. If ERROR_CODE.SUCCESS is returned, the camera is ready to use. Every other code indicates an error and the program should be stopped.

Here is the proper way to call this function:

zed = sl.Camera() # Create a ZED camera object
init_params = sl.InitParameters() # Set configuration parameters
init_params.camera_resolution = sl.RESOLUTION.HD720 # Use HD720 video mode
init_params.camera_fps = 60 # Set fps at 60
# Open the camera
err = zed.open(init_params)
if (err != sl.ERROR_CODE.SUCCESS) :
print(repr(err)) # Display the error
exit(-1)
Note
If you are having issues opening a camera, the diagnostic tool provided in the SDK can help you identify to problems.
  • Windows: C:\Program Files (x86)\ZED SDK\tools\ZED Diagnostic.exe
  • Linux: /usr/local/zed/tools/ZED Diagnostic
If this method is called on an already opened camera, close() will be called.

◆ is_opened()

bool is_opened (   self)

Reports if the camera has been successfully opened.

It has the same behavior as checking if open() returns ERROR_CODE.SUCCESS.

Returns
True if the ZED camera is already setup, otherwise false.

◆ grab()

ERROR_CODE grab (   self,
RuntimeParameters   py_runtime = RuntimeParameters() 
)

This method will grab the latest images from the camera, rectify them, and compute the measurements based on the RuntimeParameters provided (depth, point cloud, tracking, etc.)

As measures are created in this method, its execution can last a few milliseconds, depending on your parameters and your hardware.
The exact duration will mostly depend on the following parameters:

This method is meant to be called frequently in the main loop of your application.

Note
Since ZED SDK 3.0, this method is blocking. It means that grab() will wait until a new frame is detected and available.
If no new frames is available until timeout is reached, grab() will return ERROR_CODE.CAMERA_NOT_DETECTED since the camera has probably been disconnected.
Parameters
py_runtime: A structure containing all the runtime parameters. Default: a preset of RuntimeParameters.
Returns
ERROR_CODE.SUCCESS means that no problem was encountered.
Note
Returned errors can be displayed using str().
# Set runtime parameters after opening the camera
runtime_param = sl.RuntimeParameters()
image = sl.Mat()
while True:
# Grab an image
if zed.grab(runtime_param) == sl.ERROR_CODE.SUCCESS: # A new image is available if grab() returns SUCCESS
zed.retrieve_image(image, sl.VIEW.LEFT) # Get the left image
# Use the image for your application

◆ retrieve_image()

ERROR_CODE retrieve_image (   self,
Mat  py_mat,
  view = VIEW.LEFT,
  type = MEM.CPU,
  resolution = Resolution(0,0) 
)

Retrieves images from the camera (or SVO file).

Multiple images are available along with a view of various measures for display purposes.
Available images and views are listed here.
As an example, VIEW.DEPTH can be used to get a gray-scale version of the depth map, but the actual depth values can be retrieved using retrieve_measure() .

Pixels
Most VIEW modes output image with 4 channels as BGRA (Blue, Green, Red, Alpha), for more information see enum VIEW

Memory
By default, images are copied from GPU memory to CPU memory (RAM) when this function is called.
If your application can use GPU images, using the type parameter can increase performance by avoiding this copy.
If the provided sl.Mat object is already allocated and matches the requested image format, memory won't be re-allocated.

Image size
By default, images are returned in the resolution provided by get_camera_information().camera_configuration.resolution.
However, you can request custom resolutions. For example, requesting a smaller image can help you speed up your application.

Warning
A sl.Mat resolution higher than the camera resolution cannot be requested.
Parameters
py_mat[out]: The sl.Mat to store the image.
view[in]: Defines the image you want (see VIEW). Default: VIEW.LEFT.
type[in]: Defines on which memory the image should be allocated. Default: MEM.CPU (you cannot change this default value).
resolution[in]: If specified, defines the Resolution of the output sl.Mat. If set to Resolution(0,0), the camera resolution will be taken. Default: (0,0).
Returns
ERROR_CODE.SUCCESS if the method succeeded.
ERROR_CODE.INVALID_FUNCTION_PARAMETERS if the view mode requires a module not enabled (VIEW.DEPTH with DEPTH_MODE.NONE for example).
ERROR_CODE.INVALID_RESOLUTION if the resolution is higher than one provided by get_camera_information().camera_configuration.resolution.
ERROR_CODE.FAILURE if another error occurred.
Note
As this method retrieves the images grabbed by the grab() method, it should be called afterward.
# create sl.Mat objects to store the images
left_image = sl.Mat()
while True:
# Grab an image
if zed.grab() == sl.ERROR_CODE.SUCCESS: # A new image is available if grab() returns SUCCESS
zed.retrieve_image(left_image, sl.VIEW.LEFT) # Get the rectified left image
# Display the center pixel colors
err, left_center = left_image.get_value(left_image.get_width() / 2, left_image.get_height() / 2)
if err == sl.ERROR_CODE.SUCCESS:
print("left_image center pixel R:", int(left_center[0]), " G:", int(left_center[1]), " B:", int(left_center[2]))
else:
print("error:", err)

◆ retrieve_measure()

ERROR_CODE retrieve_measure (   self,
Mat  py_mat,
  measure = MEASURE.DEPTH,
  type = MEM.CPU,
  resolution = Resolution(0,0) 
)

Computed measures, like depth, point cloud, or normals, can be retrieved using this method.

Multiple measures are available after a grab() call. A full list is available here.


Memory
By default, images are copied from GPU memory to CPU memory (RAM) when this function is called.
If your application can use GPU images, using the type parameter can increase performance by avoiding this copy.
If the provided Mat object is already allocated and matches the requested image format, memory won't be re-allocated.


Measure size
By default, measures are returned in the resolution provided by get_camera_information() in CameraInformations.camera_resolution .
However, custom resolutions can be requested. For example, requesting a smaller measure can help you speed up your application.

Warning
A sl.Mat resolution higher than the camera resolution cannot be requested.
Parameters
py_mat[out]: The sl.Mat to store the measures.
measure[in]: Defines the measure you want (see MEASURE). Default: MEASURE.DEPTH.
type[in]: Defines on which memory the image should be allocated. Default: MEM.CPU (you cannot change this default value).
resolution[in]: If specified, defines the Resolution of the output sl.Mat. If set to Resolution(0,0), the camera resolution will be taken. Default: (0,0).
Returns
ERROR_CODE.SUCCESS if the method succeeded.
ERROR_CODE.INVALID_FUNCTION_PARAMETERS if the view mode requires a module not enabled (VIEW.DEPTH with DEPTH_MODE.NONE for example).
ERROR_CODE.INVALID_RESOLUTION if the resolution is higher than one provided by get_camera_information().camera_configuration.resolution.
ERROR_CODE.FAILURE if another error occured.
Note
As this method retrieves the images grabbed by the grab() method, it should be called afterward.
depth_map = sl.Mat()
point_cloud = sl.Mat()
resolution = zed.get_camera_information().camera_configuration.resolution
x = int(resolution.width / 2) # Center coordinates
y = int(resolution.height / 2)
while True :
if zed.grab() == sl.ERROR_CODE.SUCCESS: # Grab an image
zed.retrieve_measure(depth_map, sl.MEASURE.DEPTH) # Get the depth map
# Read a depth value
err, center_depth = depth_map.get_value(x, y) # each depth map pixel is a float value
if err == sl.ERROR_CODE.SUCCESS: # + Inf is "too far", -Inf is "too close", Nan is "unknown/occlusion"
print("Depth value at center:", center_depth, init_params.coordinate_units)
zed.retrieve_measure(point_cloud, sl.MEASURE.XYZRGBA) # Get the point cloud
# Read a point cloud value
err, pc_value = point_cloud.get_value(x, y) # each point cloud pixel contains 4 floats, so we are using a numpy array
# Get 3D coordinates
if err == sl.ERROR_CODE.SUCCESS:
print("Point cloud coordinates at center: X=", pc_value[0], ", Y=", pc_value[1], ", Z=", pc_value[2])
# Get color information using Python struct package to unpack the unsigned char array containing RGBA values
import struct
packed = struct.pack('f', pc_value[3])
char_array = struct.unpack('BBBB', packed)
print("Color values at center: R=", char_array[0], ", G=", char_array[1], ", B=", char_array[2], ", A=", char_array[3])

◆ set_region_of_interest()

ERROR_CODE set_region_of_interest (   self,
Mat  py_mat,
  modules = [MODULE.ALL] 
)

Defines a region of interest to focus on for all the SDK, discarding other parts.

Parameters
roi_mask: The Mat defining the requested region of interest, pixels lower than 127 will be discarded from all modules: depth, positional tracking, etc. If empty, set all pixels as valid. The mask can be either at lower or higher resolution than the current images.
Returns
An ERROR_CODE if something went wrong.
Note
The method support U8_C1/U8_C3/U8_C4 images type.

◆ get_region_of_interest()

ERROR_CODE get_region_of_interest (   self,
Mat  py_mat,
  resolution = Resolution(0,0),
  module = MODULE.ALL 
)

Get the previously set or computed region of interest.

Parameters
roi_maskThe Mat returned
image_sizeThe optional size of the returned mask
Returns
An ERROR_CODE if something went wrong.

◆ start_region_of_interest_auto_detection()

ERROR_CODE start_region_of_interest_auto_detection (   self,
  roi_param = RegionOfInterestParameters() 
)

Start the auto detection of a region of interest to focus on for all the SDK, discarding other parts.

This detection is based on the general motion of the camera combined with the motion in the scene. The camera must move for this process, an internal motion detector is used, based on the Positional Tracking module. It requires a few hundreds frames of motion to compute the mask.

Parameters
roi_paramThe RegionOfInterestParameters defining parameters for the detection
Note
This module is expecting a static portion, typically a fairly close vehicle hood at the bottom of the image. This module may not work correctly or detect incorrect background area, especially with slow motion, if there's no static element. This module work asynchronously, the status can be obtained using get_region_of_interest_auto_detection_status(), the result is either auto applied, or can be retrieve using get_region_of_interest function.
Returns
An ERROR_CODE if something went wrong.

◆ get_region_of_interest_auto_detection_status()

REGION_OF_INTEREST_AUTO_DETECTION_STATE get_region_of_interest_auto_detection_status (   self)

Return the status of the automatic Region of Interest Detection The automatic Region of Interest Detection is enabled by using startRegionOfInterestAutoDetection.

Returns
REGION_OF_INTEREST_AUTO_DETECTION_STATE the status

◆ start_publishing()

ERROR_CODE start_publishing (   self,
CommunicationParameters  communication_parameters 
)

Set this camera as a data provider for the Fusion module.

Metadata is exchanged with the Fusion.

Parameters
communication_parameters: A structure containing all the initial parameters. Default: a preset of CommunicationParameters.
Returns
ERROR_CODE.SUCCESS if everything went fine, ERROR_CODE.FAILURE otherwise.

◆ stop_publishing()

ERROR_CODE stop_publishing (   self)

Set this camera as normal camera (without data providing).

Stop to send camera data to fusion.

Returns
ERROR_CODE.SUCCESS if everything went fine, ERROR_CODE.FAILURE otherwise.

◆ set_svo_position()

None set_svo_position (   self,
int  frame_number 
)

Sets the playback cursor to the desired frame number in the SVO file.

This method allows you to move around within a played-back SVO file. After calling, the next call to grab() will read the provided frame number.

Parameters
frame_number: The number of the desired frame to be decoded.
Note
The method works only if the camera is open in SVO playback mode.
import pyzed.sl as sl
def main():
# Create a ZED camera object
zed = sl.Camera()
# Set configuration parameters
init_params = sl.InitParameters()
init_params.set_from_svo_file("path/to/my/file.svo")
# Open the camera
err = zed.open(init_params)
if err != sl.ERROR_CODE.SUCCESS:
print(repr(err))
exit(-1)
# Loop between frames 0 and 50
left_image = sl.Mat()
while zed.get_svo_position() < zed.get_svo_number_of_frames() - 1:
print("Current frame: ", zed.get_svo_position())
# Loop if we reached frame 50
if zed.get_svo_position() == 50:
zed.set_svo_position(0)
# Grab an image
if zed.grab() == sl.ERROR_CODE.SUCCESS:
zed.retrieve_image(left_image, sl.VIEW.LEFT) # Get the rectified left image
# Use the image in your application
# Close the Camera
zed.close()
return 0
if __name__ == "__main__" :
main()

◆ get_svo_position()

int get_svo_position (   self)

Returns the current playback position in the SVO file.

The position corresponds to the number of frames already read from the SVO file, starting from 0 to n.

Each grab() call increases this value by one (except when using InitParameters.svo_real_time_mode).

Returns
The current frame position in the SVO file. -1 if the SDK is not reading an SVO.
Note
The method works only if the camera is open in SVO playback mode.

See set_svo_position() for an example.

◆ get_svo_number_of_frames()

int get_svo_number_of_frames (   self)

Returns the number of frames in the SVO file.

Returns
The total number of frames in the SVO file. -1 if the SDK is not reading a SVO.

The method works only if the camera is open in SVO playback mode.

◆ ingest_data_into_svo()

ERROR_CODE ingest_data_into_svo (   self,
SVOData  data 
)

ingest a SVOData in the SVO file.

Returns
An error code stating the success, or not.

The method works only if the camera is open in SVO recording mode.

◆ get_svo_data_keys()

list get_svo_data_keys (   self)

Get the external channels that can be retrieved from the SVO file.

Returns
a list of keys

The method works only if the camera is open in SVO playback mode.

◆ retrieve_svo_data()

ERROR_CODE retrieve_svo_data (   self,
str  key,
dict  data,
Timestamp  ts_begin,
Timestamp  ts_end 
)

retrieve SVO datas from the SVO file at the given channel key and in the given timestamp range.

Returns
An error code stating the success, or not.
Parameters
key: The channel key.
data: The dict to be filled with SVOData objects, with timestamps as keys.
ts_begin: The beginning of the range.
ts_end: The end of the range.

The method works only if the camera is open in SVO playback mode.

◆ set_camera_settings_range()

ERROR_CODE set_camera_settings_range (   self,
VIDEO_SETTINGS  settings,
  min = -1,
  max = -1 
)

Sets the value of the requested camera setting that supports two values (min/max).

This method only works with the following VIDEO_SETTINGS:

Parameters
settings: The setting to be set.
min: The minimum value that can be reached (-1 or 0 gives full range).
max: The maximum value that can be reached (-1 or 0 gives full range).
Returns
ERROR_CODE to indicate if the method was successful.
Warning
If VIDEO_SETTINGS settings is not supported or min >= max, it will return ERROR_CODE.INVALID_FUNCTION_PARAMETERS.
Note
The method works only if the camera is open in LIVE or STREAM mode.
# For ZED X based product, set the automatic exposure from 2ms to 5ms. Expected exposure time cannot go beyond those values
zed.set_camera_settings_range(sl.VIDEO_SETTINGS.AEC_RANGE, 2000, 5000);

◆ set_camera_settings_roi()

ERROR_CODE set_camera_settings_roi (   self,
VIDEO_SETTINGS  settings,
Rect  roi,
  eye = SIDE.BOTH,
  reset = False 
)

Overloaded method for VIDEO_SETTINGS.AEC_AGC_ROI which takes a Rect as parameter.

Parameters
settings: Must be set at VIDEO_SETTINGS.AEC_AGC_ROI, otherwise the method will have no impact.
roi: Rect that defines the target to be applied for AEC/AGC computation. Must be given according to camera resolution.
eye: SIDE on which to be applied for AEC/AGC computation. Default: SIDE.BOTH
reset: Cancel the manual ROI and reset it to the full image. Default: False
Note
The method works only if the camera is open in LIVE or STREAM mode.
roi = sl.Rect(42, 56, 120, 15)
zed.set_camera_settings_roi(sl.VIDEO_SETTINGS.AEC_AGC_ROI, roi, sl.SIDE.BOTH)

◆ get_camera_settings()

(ERROR_CODE, int) get_camera_settings (   self,
VIDEO_SETTINGS  setting 
)

Returns the current value of the requested camera setting (gain, brightness, hue, exposure, etc.).

Possible values (range) of each setting are available here.

Parameters
setting: The requested setting.
Returns
ERROR_CODE to indicate if the method was successful.
The current value for the corresponding setting.
err, gain = zed.get_camera_settings(sl.VIDEO_SETTINGS.GAIN)
if err == sl.ERROR_CODE.SUCCESS:
print("Current gain value:", gain)
else:
print("error:", err)
Note
The method works only if the camera is open in LIVE or STREAM mode.
Settings are not exported in the SVO file format.

◆ get_camera_settings_range()

(ERROR_CODE, int, int) get_camera_settings_range (   self,
VIDEO_SETTINGS  setting 
)

Returns the values of the requested settings for VIDEO_SETTINGS that supports two values (min/max).

This method only works with the following VIDEO_SETTINGS:

Possible values (range) of each setting are available here.

Parameters
setting: The requested setting.
Returns
ERROR_CODE to indicate if the method was successful.
The current value of the minimum for the corresponding setting.
The current value of the maximum for the corresponding setting.
err, aec_range_min, aec_range_max = zed.get_camera_settings(sl.VIDEO_SETTINGS.AUTO_EXPOSURE_TIME_RANGE)
if err == sl.ERROR_CODE.SUCCESS:
print("Current AUTO_EXPOSURE_TIME_RANGE range values ==> min:", aec_range_min, "max:", aec_range_max)
else:
print("error:", err)
Note
Works only with ZED X that supports low-level controls

◆ get_camera_settings_roi()

ERROR_CODE get_camera_settings_roi (   self,
VIDEO_SETTINGS  setting,
Rect  roi,
  eye = SIDE.BOTH 
)

Returns the current value of the currently used ROI for the camera setting AEC_AGC_ROI.

Parameters
setting[in]: Must be set at VIDEO_SETTINGS.AEC_AGC_ROI, otherwise the method will have no impact.
roi[out]: Roi that will be filled.
eye[in]: The requested side. Default: SIDE.BOTH
Returns
ERROR_CODE to indicate if the method was successful.
roi = sl.Rect()
err = zed.get_camera_settings_roi(sl.VIDEO_SETTINGS.AEC_AGC_ROI, roi, sl.SIDE.BOTH)
print("Current ROI for AEC_AGC: " + str(roi.x) + " " + str(roi.y)+ " " + str(roi.width) + " " + str(roi.height))
Note
Works only if the camera is open in LIVE or STREAM mode with VIDEO_SETTINGS.AEC_AGC_ROI.
It will return ERROR_CODE.INVALID_FUNCTION_CALL or ERROR_CODE.INVALID_FUNCTION_PARAMETERS otherwise.

◆ is_camera_setting_supported()

bool is_camera_setting_supported (   self,
VIDEO_SETTINGS  setting 
)

Returns if the video setting is supported by the camera or not.

Parameters
setting[in]: the video setting to test
Returns
True if the VIDEO_SETTINGS is supported by the camera, False otherwise

◆ get_current_fps()

float get_current_fps (   self)

Returns the current framerate at which the grab() method is successfully called.

The returned value is based on the difference of camera timestamps between two successful grab() calls.

Returns
The current SDK framerate
Warning
The returned framerate (number of images grabbed per second) can be lower than InitParameters.camera_fps if the grab() function runs slower than the image stream or is called too often.
current_fps = zed.get_current_fps()
print("Current framerate: ", current_fps)

◆ get_timestamp()

Timestamp get_timestamp (   self,
TIME_REFERENCE  time_reference 
)

Returns the timestamp in the requested TIME_REFERENCE.

  • When requesting the TIME_REFERENCE.IMAGE timestamp, the UNIX nanosecond timestamp of the latest grabbed image will be returned.
    This value corresponds to the time at which the entire image was available in the PC memory. As such, it ignores the communication time that corresponds to 2 or 3 frame-time based on the fps (ex: 33.3ms to 50ms at 60fps).
  • When requesting the TIME_REFERENCE.CURRENT timestamp, the current UNIX nanosecond timestamp is returned.

This function can also be used when playing back an SVO file.

Parameters
time_reference: The selected TIME_REFERENCE.
Returns
The Timestamp in nanosecond. 0 if not available (SVO file without compression).
Note
As this function returns UNIX timestamps, the reference it uses is common across several Camera instances.
This can help to organized the grabbed images in a multi-camera application.
last_image_timestamp = zed.get_timestamp(sl.TIME_REFERENCE.IMAGE)
current_timestamp = zed.get_timestamp(sl.TIME_REFERENCE.CURRENT)
print("Latest image timestamp: ", last_image_timestamp.get_nanoseconds(), "ns from Epoch.")
print("Current timestamp: ", current_timestamp.get_nanoseconds(), "ns from Epoch.")

◆ get_frame_dropped_count()

int get_frame_dropped_count (   self)

Returns the number of frames dropped since grab() was called for the first time.

A dropped frame corresponds to a frame that never made it to the grab method.
This can happen if two frames were extracted from the camera when grab() is called. The older frame will be dropped so as to always use the latest (which minimizes latency).

Returns
The number of frames dropped since the first grab() call.

◆ get_current_min_max_depth()

ERROR_CODE get_current_min_max_depth (   self,
float  min,
float  max 
)

Gets the current range of perceived depth.

Parameters
min[out]: Minimum depth detected (in selected sl.UNIT).
max[out]: Maximum depth detected (in selected sl.UNIT).
Returns
ERROR_CODE.SUCCESS if values can be extracted, ERROR_CODE.FAILURE otherwise.

◆ get_camera_information()

CameraInformation get_camera_information (   self,
  resizer = Resolution(0, 0) 
)

Returns the CameraInformation associated the camera being used.

To ensure accurate calibration, it is possible to specify a custom resolution as a parameter when obtaining scaled information, as calibration parameters are resolution-dependent.
When reading an SVO file, the parameters will correspond to the camera used for recording.

Parameters
resizer: You can specify a size different from the default image size to get the scaled camera information. Default = (0,0) meaning original image size (given by get_camera_information().camera_configuration.resolution).
Returns
CameraInformation containing the calibration parameters of the ZED, as well as serial number and firmware version.
Warning
The returned parameters might vary between two execution due to the self-calibration being run in the open() method.
Note
The calibration file SNXXXX.conf can be found in:
  • Windows: C:/ProgramData/Stereolabs/settings/
  • Linux: /usr/local/zed/settings/

◆ get_runtime_parameters()

RuntimeParameters get_runtime_parameters (   self)

Returns the RuntimeParameters used.

It corresponds to the structure given as argument to the grab() method.

Returns
RuntimeParameters containing the parameters that define the behavior of the grab method.

◆ get_init_parameters()

InitParameters get_init_parameters (   self)

Returns the InitParameters associated with the Camera object.

It corresponds to the structure given as argument to open() method.

Returns
InitParameters containing the parameters used to initialize the Camera object.

◆ get_positional_tracking_parameters()

PositionalTrackingParameters get_positional_tracking_parameters (   self)

Returns the PositionalTrackingParameters used.

It corresponds to the structure given as argument to the enable_positional_tracking() method.

Returns
PositionalTrackingParameters containing the parameters used for positional tracking initialization.

◆ get_spatial_mapping_parameters()

SpatialMappingParameters get_spatial_mapping_parameters (   self)

Returns the SpatialMappingParameters used.

It corresponds to the structure given as argument to the enable_spatial_mapping() method.

Returns
SpatialMappingParameters containing the parameters used for spatial mapping initialization.

◆ get_object_detection_parameters()

ObjectDetectionParameters get_object_detection_parameters (   self,
  instance_module_id = 0 
)

Returns the ObjectDetectionParameters used.

It corresponds to the structure given as argument to the enable_object_detection() method.

Returns
ObjectDetectionParameters containing the parameters used for object detection initialization.

◆ get_body_tracking_parameters()

BodyTrackingParameters get_body_tracking_parameters (   self,
  instance_id = 0 
)

Returns the BodyTrackingParameters used.

It corresponds to the structure given as argument to the enable_body_tracking() method.

Returns
BodyTrackingParameters containing the parameters used for body tracking initialization.

◆ get_streaming_parameters()

StreamingParameters get_streaming_parameters (   self)

Returns the StreamingParameters used.

It corresponds to the structure given as argument to the enable_streaming() method.

Returns
StreamingParameters containing the parameters used for streaming initialization.

◆ enable_positional_tracking()

ERROR_CODE enable_positional_tracking (   self,
  py_tracking = PositionalTrackingParameters() 
)

Initializes and starts the positional tracking processes.

This method allows you to enable the position estimation of the SDK. It only has to be called once in the camera's lifetime.
When enabled, the position will be update at each grab() call.
Tracking-specific parameters can be set by providing PositionalTrackingParameters to this method.

Parameters
py_tracking: A structure containing all the specific parameters for the positional tracking. Default: a preset of PositionalTrackingParameters.
Returns
ERROR_CODE.FAILURE if the PositionalTrackingParameters.area_file_path file wasn't found, ERROR_CODE.SUCCESS otherwise.
Warning
The positional tracking feature benefits from a high framerate. We found HD720@60fps to be the best compromise between image quality and framerate.
import pyzed.sl as sl
def main() :
# --- Initialize a Camera object and open the ZED
# Create a ZED camera object
zed = sl.Camera()
# Set configuration parameters
init_params = sl.InitParameters()
init_params.camera_resolution = sl.RESOLUTION.HD720 # Use HD720 video mode
init_params.camera_fps = 60 # Set fps at 60
# Open the camera
err = zed.open(init_params)
if err != sl.ERROR_CODE.SUCCESS:
print(repr(err))
exit(-1)
# Set tracking parameters
track_params = sl.PositionalTrackingParameters()
# Enable positional tracking
err = zed.enable_positional_tracking(track_params)
if err != sl.ERROR_CODE.SUCCESS:
print("Tracking error: ", repr(err))
exit(-1)
# --- Main loop
while True:
if zed.grab() == sl.ERROR_CODE.SUCCESS: # Grab an image and computes the tracking
camera_pose = sl.Pose()
zed.get_position(camera_pose, sl.REFERENCE_FRAME.WORLD)
translation = camera_pose.get_translation().get()
print("Camera position: X=", translation[0], " Y=", translation[1], " Z=", translation[2])
# --- Close the Camera
zed.close()
return 0
if __name__ == "__main__" :
main()

◆ update_self_calibration()

None update_self_calibration (   self)

Performs a new self-calibration process.

In some cases, due to temperature changes or strong vibrations, the stereo calibration becomes less accurate.
Use this method to update the self-calibration data and get more reliable depth values.

Note
The self-calibration will occur at the next grab() call.
This method is similar to the previous reset_self_calibration() used in 2.X SDK versions.
Warning
New values will then be available in get_camera_information(), be sure to get them to still have consistent 2D <-> 3D conversion.

◆ enable_body_tracking()

ERROR_CODE enable_body_tracking (   self,
BodyTrackingParameters   body_tracking_parameters = BodyTrackingParameters() 
)

Initializes and starts the body tracking module.

The body tracking module currently supports multiple classes of human skeleton detection with the BODY_TRACKING_MODEL.HUMAN_BODY_FAST, BODY_TRACKING_MODEL::HUMAN_BODY_MEDIUM or BODY_TRACKING_MODEL::HUMAN_BODY_ACCURATE.
This model only detects humans but provides a full skeleton map for each person.


Detected objects can be retrieved using the retrieve_bodies() method.

Note
- This Deep Learning detection module is not available for MODEL.ZED cameras (first generation ZED cameras).
- This feature uses AI to locate objects and requires a powerful GPU. A GPU with at least 3GB of memory is recommended.
Parameters
body_tracking_parameters: A structure containing all the specific parameters for the object detection. Default: a preset of BodyTrackingParameters.
Returns
ERROR_CODE.SUCCESS if everything went fine.
ERROR_CODE.OBJECT_DETECTION_NOT_AVAILABLE if the AI model is missing or corrupted. In this case, the SDK needs to be reinstalled
ERROR_CODE.OBJECT_DETECTION_MODULE_NOT_COMPATIBLE_WITH_CAMERA if the camera used does not have an IMU (MODEL.ZED).
ERROR_CODE.SENSORS_NOT_DETECTED if the camera model is correct (not MODEL.ZED) but the IMU is missing. It probably happens because InitParameters.sensors_required was set to False and that IMU has not been found.
ERROR_CODE.INVALID_FUNCTION_CALL if one of the body_tracking_parameters parameter is not compatible with other modules parameters (for example, depth_mode has been set to DEPTH_MODE.NONE).
ERROR_CODE.FAILURE otherwise.
import pyzed.sl as sl
def main() :
# Create a ZED camera object
zed = sl.Camera()
# Open the camera
err = zed.open()
if err != sl.ERROR_CODE.SUCCESS:
print("Opening camera error:", repr(err))
exit(-1)
# Enable position tracking (mandatory for object detection)
tracking_params = sl.PositionalTrackingParameters()
err = zed.enable_positional_tracking(tracking_params)
if err != sl.ERROR_CODE.SUCCESS:
print("Enabling Positional Tracking error:", repr(err))
exit(-1)
# Set the body tracking parameters
body_tracking_params = sl.BodyTrackingParameters()
# Enable the body tracking
err = zed.enable_body_tracking(body_tracking_params)
if err != sl.ERROR_CODE.SUCCESS:
print("Enabling Body Tracking error:", repr(err))
exit(-1)
# Grab an image and detect bodies on it
bodies = sl.Bodies()
while True :
if zed.grab() == sl.ERROR_CODE.SUCCESS:
zed.retrieve_bodies(bodies)
print(len(bodies.body_list), "bodies detected")
# Use the bodies in your application
# Close the camera
zed.disable_body_tracking()
zed.close()
if __name__ == "__main__":
main()

◆ disable_body_tracking()

None disable_body_tracking (   self,
int   instance_id = 0,
bool   force_disable_all_instances = False 
)

Disables the body tracking process.

The body tracking module immediately stops and frees its memory allocations.

Parameters
instance_id: Id of the body tracking instance. Used when multiple instances of the body tracking module are enabled at the same time.
force_disable_all_instances: Should disable all instances of the body tracking module or just instance_module_id.
Note
If the body tracking has been enabled, this method will automatically be called by close().

◆ retrieve_bodies()

ERROR_CODE retrieve_bodies (   self,
Bodies  bodies,
BodyTrackingRuntimeParameters   body_tracking_runtime_parameters = BodyTrackingRuntimeParameters(),
int   instance_id = 0 
)

Retrieves body tracking data from the body tracking module.

This method returns the result of the body tracking, whether the module is running synchronously or asynchronously.

  • Asynchronous: this method immediately returns the last bodies tracked. If the current tracking isn't done, the bodies from the last tracking will be returned, and Bodies.is_new will be set to False.
  • Synchronous: this method executes tracking and waits for it to finish before returning the detected objects.

It is recommended to keep the same Bodies object as the input of all calls to this method. This will enable the identification and the tracking of every detected object.

Parameters
bodies: The detected bodies will be saved into this object. If the object already contains data from a previous tracking, it will be updated, keeping a unique ID for the same person.
body_tracking_runtime_parameters: Body tracking runtime settings, can be changed at each tracking. In async mode, the parameters update is applied on the next iteration.
instance_id: Id of the body tracking instance. Used when multiple instances of the body tracking module are enabled at the same time.
Returns
ERROR_CODE.SUCCESS if everything went fine, ERROR_CODE.FAILURE otherwise.
bodies = sl.Bodies() # Unique Bodies to be updated after each grab
# Main loop
while True:
if zed.grab() == sl.ERROR_CODE.SUCCESS: # Grab an image from the camera
zed.retrieve_bodies(bodies)
print(len(bodies.body_list), "bodies detected")

◆ get_sensors_data()

ERROR_CODE get_sensors_data (   self,
SensorsData  py_sensors_data,
  time_reference = TIME_REFERENCE.CURRENT 
)

Retrieves the SensorsData (IMU, magnetometer, barometer) at a specific time reference.

SensorsData object contains the previous IMUData structure that was used in ZED SDK v2.X:
For IMU data, the values are provided in 2 ways :

The delta time between previous and current values can be calculated using data.imu.timestamp

Note
The IMU quaternion (fused data) is given in the specified COORDINATE_SYSTEM of InitParameters.
Parameters
data[out]: The SensorsData variable to store the data.
reference_frame[in]Defines the reference from which you want the data to be expressed. Default: REFERENCE_FRAME.WORLD.
Returns
ERROR_CODE.SUCCESS if sensors data have been extracted.
ERROR_CODE.SENSORS_NOT_AVAILABLE if the camera model is a MODEL.ZED.
ERROR_CODE.MOTION_SENSORS_REQUIRED if the camera model is correct but the sensors module is not opened.
ERROR_CODE.INVALID_FUNCTION_PARAMETERS if the reference_time is not valid. See Warning.
Warning
In SVO reading mode, the TIME_REFERENCE.CURRENT is currently not available (yielding ERROR_CODE.INVALID_FUNCTION_PARAMETERS.
Only the quaternion data and barometer data (if available) at TIME_REFERENCE.IMAGE are available. Other values will be set to 0.

◆ set_imu_prior()

ERROR_CODE set_imu_prior (   self,
Transform  transfom 
)

Set an optional IMU orientation hint that will be used to assist the tracking during the next grab().

This method can be used to assist the positional tracking rotation.

Note
This method is only effective if the camera has a model other than a MODEL.ZED, which does not contains internal sensors.
Warning
It needs to be called before the grab() method.
Parameters
transform: Transform to be ingested into IMU fusion. Note that only the rotation is used.
Returns
ERROR_CODE.SUCCESS if the transform has been passed, ERROR_CODE.INVALID_FUNCTION_CALL otherwise (e.g. when used with a ZED camera which doesn't have IMU data).

◆ get_position()

POSITIONAL_TRACKING_STATE get_position (   self,
Pose  py_pose,
  reference_frame = REFERENCE_FRAME.WORLD 
)

Retrieves the estimated position and orientation of the camera in the specified reference frame.

If the tracking has been initialized with PositionalTrackingParameters.enable_area_memory to True (default), this method can return POSITIONAL_TRACKING_STATE.SEARCHING. This means that the tracking lost its link to the initial referential and is currently trying to relocate the camera. However, it will keep on providing position estimations.

Parameters
camera_pose[out]The pose containing the position of the camera and other information (timestamp, confidence).
reference_frame[in]: Defines the reference from which you want the pose to be expressed. Default: REFERENCE_FRAME.WORLD.
Returns
The current state of the tracking process.
Note
Extract Rotation Matrix: Pose.get_rotation_matrix()
Extract Translation Vector: Pose.get_translation()
Extract Orientation / Quaternion: Pose.get_orientation()
Warning
This method requires the tracking to be enabled. enablePositionalTracking() .
Note
The position is provided in the InitParameters.coordinate_system . See COORDINATE_SYSTEM for its physical origin.
while True:
if zed.grab() == sl.ERROR_CODE.SUCCESS: # Grab an image and computes the tracking
camera_pose = sl.Pose()
zed.get_position(camera_pose, sl.REFERENCE_FRAME.WORLD)
translation = camera_pose.get_translation().get()
print("Camera position: X=", translation[0], " Y=", translation[1], " Z=", translation[2])
print("Camera Euler rotation: X=", camera_pose.get_euler_angles()[0], " Y=", camera_pose.get_euler_angles()[1], " Z=", camera_pose.get_euler_angles()[2])
print("Camera Rodrigues rotation: X=", camera_pose.get_rotation_vector()[0], " Y=", camera_pose.get_rotation_vector()[1], " Z=", camera_pose.get_rotation_vector()[2])
orientation = camera_pose.get_orientation().get()
print("Camera quaternion orientation: X=", orientation[0], " Y=", orientation[1], " Z=", orientation[2], " W=", orientation[3])

◆ get_positional_tracking_status()

PositionalTrackingStatus get_positional_tracking_status (   self)

Return the current status of positional tracking module.

Returns
sl::PositionalTrackingStatus current status of positional tracking module.

◆ get_area_export_state()

AREA_EXPORTING_STATE get_area_export_state (   self)

Returns the state of the spatial memory export process.

As Camera.save_area_map() only starts the exportation, this method allows you to know when the exportation finished or if it failed.

Returns
The current state of the spatial memory export process.

◆ save_area_map()

ERROR_CODE save_area_map (   self,
  area_file_path = "" 
)

Saves the current area learning file.

The file will contain spatial memory data generated by the tracking.

If the tracking has been initialized with PositionalTrackingParameters.enable_area_memory to True (default), the method allows you to export the spatial memory.
Reloading the exported file in a future session with PositionalTrackingParameters.area_file_path initializes the tracking within the same referential.
This method is asynchronous, and only triggers the file generation. You can use get_area_export_state() to get the export state. The positional tracking keeps running while exporting.

Parameters
area_file_path: Path of an '.area' file to save the spatial memory database in.
Returns
ERROR_CODE.FAILURE if the area_file_path file wasn't found, ERROR_CODE.SUCCESS otherwise.

See get_area_export_state()

Note
Please note that this method will also flush the area database that was built/loaded.
Warning
If the camera wasn't moved during the tracking session, or not enough, the spatial memory won't be usable and the file won't be exported.
The get_area_export_state() will return AREA_EXPORTING_STATE.FILE_EMPTY.
A few meters (~3m) of translation or a full rotation should be enough to get usable spatial memory.
However, as it should be used for relocation purposes, visiting a significant portion of the environment is recommended before exporting.
while True :
if zed.grab() == sl.ERROR_CODE.SUCCESS: # Grab an image and computes the tracking
camera_pose = Pose()
zed.get_position(camera_pose, REFERENCE_FRAME.WORLD)
# Export the spatial memory for future sessions
zed.save_area_map("office.area") # The actual file will be created asynchronously.
print(repr(zed.get_area_export_state()))
# Close the camera
zed.close()

◆ disable_positional_tracking()

None disable_positional_tracking (   self,
  area_file_path = "" 
)

Disables the positional tracking.

The positional tracking is immediately stopped. If a file path is given, save_area_map() will be called asynchronously. See get_area_export_state() to get the exportation state. If the tracking has been enabled, this function will automatically be called by close() .

Parameters
area_file_path: If set, saves the spatial memory into an '.area' file. Default: (empty)
area_file_path is the name and path of the database, e.g. path/to/file/myArea1.area".

◆ reset_positional_tracking()

ERROR_CODE reset_positional_tracking (   self,
Transform  path 
)

Resets the tracking, and re-initializes the position with the given transformation matrix.

Parameters
path: Position of the camera in the world frame when the method is called.
Returns
ERROR_CODE.SUCCESS if the tracking has been reset, ERROR_CODE.FAILURE otherwise.
Note
Please note that this method will also flush the accumulated or loaded spatial memory.

◆ enable_spatial_mapping()

ERROR_CODE enable_spatial_mapping (   self,
  py_spatial = SpatialMappingParameters() 
)

Initializes and starts the spatial mapping processes.

The spatial mapping will create a geometric representation of the scene based on both tracking data and 3D point clouds. The resulting output can be a Mesh or a FusedPointCloud. It can be be obtained by calling extract_whole_spatial_map() or retrieve_spatial_map_async(). Note that retrieve_spatial_map_async should be called after request_spatial_map_async().

Parameters
py_spatial: A structure containing all the specific parameters for the spatial mapping. Default: a balanced parameter preset between geometric fidelity and output file size. For more information, see the SpatialMappingParameters documentation.
Returns
ERROR_CODE.SUCCESS if everything went fine, ERROR_CODE.FAILURE otherwise.
Warning
The tracking (enable_positional_tracking() ) and the depth (RuntimeParameters.enable_depth ) needs to be enabled to use the spatial mapping.
The performance greatly depends on the py_spatial.
Lower SpatialMappingParameters.range_meter and SpatialMappingParameters.resolution_meter for higher performance. If the mapping framerate is too slow in live mode, consider using an SVO file, or choose a lower mesh resolution.
Note
This feature uses host memory (RAM) to store the 3D map. The maximum amount of available memory allowed can be tweaked using the SpatialMappingParameters.
Exceeding the maximum memory allowed immediately stops the mapping.
import pyzed.sl as sl
def main() :
# Create a ZED camera object
zed = sl.Camera()
# Set initial parameters
init_params = sl.InitParameters()
init_params.camera_resolution = sl.RESOLUTION.HD720 # Use HD720 video mode (default fps: 60)
init_params.coordinate_system = sl.COORDINATE_SYSTEM.RIGHT_HANDED_Y_UP # Use a right-handed Y-up coordinate system (The OpenGL one)
init_params.coordinate_units = sl.UNIT.METER # Set units in meters
# Open the camera
err = zed.open(init_params)
if err != sl.ERROR_CODE.SUCCESS:
exit(-1)
# Positional tracking needs to be enabled before using spatial mapping
tracking_parameters = sl.PositionalTrackingParameters()
err = zed.enable_positional_tracking(tracking_parameters)
if err != sl.ERROR_CODE.SUCCESS:
exit(-1)
# Enable spatial mapping
mapping_parameters = sl.SpatialMappingParameters()
err = zed.enable_spatial_mapping(mapping_parameters)
if err != sl.ERROR_CODE.SUCCESS:
exit(-1)
# Grab data during 500 frames
i = 0
mesh = sl.Mesh() # Create a mesh object
while i < 500 :
# For each new grab, mesh data is updated
if zed.grab() == sl.ERROR_CODE.SUCCESS :
# In the background, the spatial mapping will use newly retrieved images, depth and pose to update the mesh
mapping_state = zed.get_spatial_mapping_state()
# Print spatial mapping state
print("Images captured: ", i, "/ 500 || Spatial mapping state: ", repr(mapping_state))
i = i + 1
# Extract, filter and save the mesh in a .obj file
print("Extracting Mesh ...")
zed.extract_whole_spatial_map(mesh) # Extract the whole mesh
print("Filtering Mesh ...")
mesh.filter(sl.MESH_FILTER.LOW) # Filter the mesh (remove unnecessary vertices and faces)
print("Saving Mesh in mesh.obj ...")
mesh.save("mesh.obj") # Save the mesh in an obj file
# Disable tracking and mapping and close the camera
zed.disable_spatial_mapping()
zed.disable_positional_tracking()
zed.close()
return 0
if __name__ == "__main__" :
main()

◆ pause_spatial_mapping()

None pause_spatial_mapping (   self,
bool  status 
)

Pauses or resumes the spatial mapping processes.

As spatial mapping runs asynchronously, using this method can pause its computation to free some processing power, and resume it again later.
For example, it can be used to avoid mapping a specific area or to pause the mapping when the camera is static.

Parameters
status: If True, the integration is paused. If False, the spatial mapping is resumed.

◆ get_spatial_mapping_state()

SPATIAL_MAPPING_STATE get_spatial_mapping_state (   self)

Returns the current spatial mapping state.

As the spatial mapping runs asynchronously, this method allows you to get reported errors or status info.

Returns
The current state of the spatial mapping process.

See also SPATIAL_MAPPING_STATE

◆ request_spatial_map_async()

None request_spatial_map_async (   self)

Starts the spatial map generation process in a non-blocking thread from the spatial mapping process.

The spatial map generation can take a long time depending on the mapping resolution and covered area. This function will trigger the generation of a mesh without blocking the program. You can get info about the current generation using get_spatial_map_request_status_async(), and retrieve the mesh using retrieve_spatial_map_async().

Note
Only one mesh can be generated at a time. If the previous mesh generation is not over, new calls of the function will be ignored.

◆ get_spatial_map_request_status_async()

ERROR_CODE get_spatial_map_request_status_async (   self)

Returns the spatial map generation status.

This status allows you to know if the mesh can be retrieved by calling retrieve_spatial_map_async().

Returns
ERROR_CODE.SUCCESS if the mesh is ready and not yet retrieved, otherwise ERROR_CODE.FAILURE.

◆ retrieve_spatial_map_async()

ERROR_CODE retrieve_spatial_map_async (   self,
  py_mesh 
)

Retrieves the current generated spatial map.

After calling request_spatial_map_async(), this method allows you to retrieve the generated mesh or fused point cloud.
The Mesh or FusedPointCloud will only be available when get_spatial_map_request_status_async() returns ERROR_CODE.SUCCESS.

Parameters
py_mesh[out]: The Mesh or FusedPointCloud to be filled with the generated spatial map.
Returns
ERROR_CODE.SUCCESS if the mesh is retrieved, otherwise ERROR_CODE.FAILURE.
Note
This method only updates the necessary chunks and adds the new ones in order to improve update speed.
Warning
You should not modify the mesh / fused point cloud between two calls of this method, otherwise it can lead to a corrupted mesh / fused point cloud. See request_spatial_map_async() for an example.

◆ extract_whole_spatial_map()

ERROR_CODE extract_whole_spatial_map (   self,
  py_mesh 
)

Extract the current spatial map from the spatial mapping process.

If the object to be filled already contains a previous version of the mesh / fused point cloud, only changes will be updated, optimizing performance.

Parameters
py_mesh[out]: The Mesh or FuesedPointCloud to be filled with the generated spatial map.
Returns
ERROR_CODE.SUCCESS if the mesh is filled and available, otherwise ERROR_CODE.FAILURE.
Warning
This is a blocking function. You should either call it in a thread or at the end of the mapping process. The extraction can be long, calling this function in the grab loop will block the depth and tracking computation giving bad results.

◆ find_plane_at_hit()

ERROR_CODE find_plane_at_hit (   self,
  coord,
Plane  py_plane,
  parameters = PlaneDetectionParameters() 
)

Checks the plane at the given left image coordinates.

This method gives the 3D plane corresponding to a given pixel in the latest left image grabbed.
The pixel coordinates are expected to be contained x=[0;width-1] and y=[0;height-1], where width/height are defined by the input resolution.

Parameters
coord[in]: The image coordinate. The coordinate must be taken from the full-size image
plane[out]: The detected plane if the method succeeded.
parameters[in]: A structure containing all the specific parameters for the plane detection. Default: a preset of PlaneDetectionParameters.
Returns
ERROR_CODE.SUCCESS if a plane is found otherwise ERROR_CODE.PLANE_NOT_FOUND.
Note
The reference frame is defined by the RuntimeParameters.measure3D_reference_frame given to the grab() method.

◆ find_floor_plane()

ERROR_CODE find_floor_plane (   self,
Plane  py_plane,
Transform  reset_tracking_floor_frame,
  floor_height_prior = float('nan'),
  world_orientation_prior = Rotation(Matrix3f().zeros()),
  floor_height_prior_tolerance = float('nan') 
)

Detect the floor plane of the scene.

This method analyses the latest image and depth to estimate the floor plane of the scene.
It expects the floor plane to be visible and bigger than other candidate planes, like a table.

Parameters
py_plane[out]: The detected floor plane if the method succeeded.
reset_tracking_floor_frame[out]: The transform to align the tracking with the floor plane.
The initial position will then be at ground height, with the axis align with the gravity.
The positional tracking needs to be reset/enabled with this transform as a parameter (PositionalTrackingParameters.initial_world_transform).
floor_height_prior[in]: Prior set to locate the floor plane depending on the known camera distance to the ground, expressed in the same unit as the ZED.
If the prior is too far from the detected floor plane, the method will return ERROR_CODE.PLANE_NOT_FOUND.
world_orientation_prior[in]: Prior set to locate the floor plane depending on the known camera orientation to the ground.
If the prior is too far from the detected floor plane, the method will return ERROR_CODE.PLANE_NOT_FOUND.
floor_height_prior_tolerance[in]: Prior height tolerance, absolute value.
Returns
ERROR_CODE.SUCCESS if the floor plane is found and matches the priors (if defined), otherwise ERROR_CODE.PLANE_NOT_FOUND.
Note
The reference frame is defined by the sl.RuntimeParameters (measure3D_reference_frame) given to the grab() method.
The length unit is defined by sl.InitParameters (coordinate_units).
With the ZED, the assumption is made that the floor plane is the dominant plane in the scene. The ZED Mini uses gravity as prior.

◆ disable_spatial_mapping()

None disable_spatial_mapping (   self)

Disables the spatial mapping process.

The spatial mapping is immediately stopped.
If the mapping has been enabled, this method will automatically be called by close().

Note
This method frees the memory allocated for the spatial mapping, consequently, meshes and fused point clouds cannot be retrieved after this call.

◆ enable_streaming()

ERROR_CODE enable_streaming (   self,
  streaming_parameters = StreamingParameters() 
)

Creates a streaming pipeline.

Parameters
streaming_parameters: A structure containing all the specific parameters for the streaming. Default: a reset of StreamingParameters .
Returns
ERROR_CODE.SUCCESS if the streaming was successfully started.
ERROR_CODE.INVALID_FUNCTION_CALL if open() was not successfully called before.
ERROR_CODE.FAILURE if streaming RTSP protocol was not able to start.
ERROR_CODE.NO_GPU_COMPATIBLE if the streaming codec is not supported (in this case, use H264 codec which is supported on all NVIDIA GPU the ZED SDK supports).
import pyzed.sl as sl
def main() :
# Create a ZED camera object
zed = sl.Camera()
# Set initial parameters
init_params = sl.InitParameters()
init_params.camera_resolution = sl.RESOLUTION.HD720 # Use HD720 video mode (default fps: 60)
# Open the camera
err = zed.open(init_params)
if err != sl.ERROR_CODE.SUCCESS :
print(repr(err))
exit(-1)
# Enable streaming
stream_params = sl.StreamingParameters()
stream_params.port = 30000
stream_params.bitrate = 8000
err = zed.enable_streaming(stream_params)
if err != sl.ERROR_CODE.SUCCESS :
print(repr(err))
exit(-1)
# Grab data during 500 frames
i = 0
while i < 500 :
if zed.grab() == sl.ERROR_CODE.SUCCESS :
i = i+1
zed.disable_streaming()
zed.close()
return 0
if __name__ == "__main__" :
main()

◆ disable_streaming()

None disable_streaming (   self)

Disables the streaming initiated by enable_streaming().

Note
This method will automatically be called by close() if enable_streaming() was called.

See enable_streaming() for an example.

◆ is_streaming_enabled()

bool is_streaming_enabled (   self)

Tells if the streaming is running.

Returns
True if the stream is running, False otherwise.

◆ enable_recording()

ERROR_CODE enable_recording (   self,
RecordingParameters  record 
)

Creates an SVO file to be filled by enable_recording() and disable_recording().


SVO files are custom video files containing the un-rectified images from the camera along with some meta-data like timestamps or IMU orientation (if applicable).
They can be used to simulate a live ZED and test a sequence with various SDK parameters.
Depending on the application, various compression modes are available. See SVO_COMPRESSION_MODE.

Parameters
record: A structure containing all the specific parameters for the recording such as filename and compression mode. Default: a reset of RecordingParameters .
Returns
An ERROR_CODE that defines if the SVO file was successfully created and can be filled with images.
Warning
This method can be called multiple times during a camera lifetime, but if video_filename is already existing, the file will be erased.
import pyzed.sl as sl
def main() :
# Create a ZED camera object
zed = sl.Camera()
# Set initial parameters
init_params = sl.InitParameters()
init_params.camera_resolution = sl.RESOLUTION.HD720 # Use HD720 video mode (default fps: 60)
init_params.coordinate_units = sl.UNIT.METER # Set units in meters
# Open the camera
err = zed.open(init_params)
if (err != sl.ERROR_CODE.SUCCESS):
print(repr(err))
exit(-1)
# Enable video recording
record_params = sl.RecordingParameters("myVideoFile.svo")
err = zed.enable_recording(record_params)
if (err != sl.ERROR_CODE.SUCCESS):
print(repr(err))
exit(-1)
# Grab data during 500 frames
i = 0
while i < 500 :
# Grab a new frame
if zed.grab() == sl.ERROR_CODE.SUCCESS:
# Record the grabbed frame in the video file
i = i + 1
zed.disable_recording()
print("Video has been saved ...")
zed.close()
return 0
if __name__ == "__main__" :
main()

◆ disable_recording()

None disable_recording (   self)

Disables the recording initiated by enable_recording() and closes the generated file.

Note
This method will automatically be called by close() if enable_recording() was called.

See enable_recording() for an example.

◆ get_recording_status()

RecordingStatus get_recording_status (   self)

Get the recording information.

Returns
The recording state structure. For more details, see RecordingStatus.

◆ pause_recording()

None pause_recording (   self,
  value = True 
)

Pauses or resumes the recording.

Parameters
status: If True, the recording is paused. If False, the recording is resumed.

◆ get_recording_parameters()

RecordingParameters get_recording_parameters (   self)

Returns the RecordingParameters used.

It corresponds to the structure given as argument to the enable_recording() method.

Returns
RecordingParameters containing the parameters used for recording initialization.

◆ enable_object_detection()

ERROR_CODE enable_object_detection (   self,
  object_detection_parameters = ObjectDetectionParameters() 
)

Initializes and starts object detection module.

The object detection module currently supports multiple class of objects with the OBJECT_DETECTION_MODEL.MULTI_CLASS_BOX or OBJECT_DETECTION_MODEL.MULTI_CLASS_BOX_ACCURATE.
The full list of detectable objects is available through OBJECT_CLASS and OBJECT_SUBCLASS.


Detected objects can be retrieved using the retrieve_objects() method. the retrieve_objects() method will be blocking during the detection.

Note
- This Depth Learning detection module is not available MODEL.ZED cameras.
- This feature uses AI to locate objects and requires a powerful GPU. A GPU with at least 3GB of memory is recommended.
Parameters
object_detection_parameters: A structure containing all the specific parameters for the object detection. Default: a preset of ObjectDetectionParameters.
Returns
ERROR_CODE.SUCCESS if everything went fine.
ERROR_CODE.OBJECT_DETECTION_NOT_AVAILABLE if the AI model is missing or corrupted. In this case, the SDK needs to be reinstalled
ERROR_CODE.OBJECT_DETECTION_MODULE_NOT_COMPATIBLE_WITH_CAMERA if the camera used does not have an IMU (MODEL.ZED).
ERROR_CODE.SENSORS_NOT_DETECTED if the camera model is correct (not MODEL.ZED) but the IMU is missing. It probably happens because InitParameters.sensors_required was set to False and that IMU has not been found.
ERROR_CODE.INVALID_FUNCTION_CALL if one of the object_detection_parameters parameter is not compatible with other modules parameters (for example, depth_mode has been set to DEPTH_MODE.NONE).
ERROR_CODE.FAILURE otherwise.
Note
The IMU gives the gravity vector that helps in the 3D box localization. Therefore the object detection module is not available for the MODEL.ZED models.
import pyzed.sl as sl
def main():
# Create a ZED camera object
zed = sl.Camera()
# Open the camera
err = zed.open()
if err != sl.ERROR_CODE.SUCCESS:
print("Opening camera error:", repr(err))
exit(-1)
# Enable position tracking (mandatory for object detection)
tracking_params = sl.PositionalTrackingParameters()
err = zed.enable_positional_tracking(tracking_params)
if err != sl.ERROR_CODE.SUCCESS:
print("Enabling Positional Tracking error:", repr(err))
exit(-1)
# Set the object detection parameters
object_detection_params = sl.ObjectDetectionParameters()
# Enable the object detection
err = zed.enable_object_detection(object_detection_params)
if err != sl.ERROR_CODE.SUCCESS:
print("Enabling Object Detection error:", repr(err))
exit(-1)
# Grab an image and detect objects on it
objects = sl.Objects()
while True:
if zed.grab() == sl.ERROR_CODE.SUCCESS:
zed.retrieve_objects(objects)
print(len(objects.object_list), "objects detected")
# Use the objects in your application
# Close the camera
zed.disable_object_detection()
zed.close()
if __name__ == "__main__":
main()

◆ disable_object_detection()

None disable_object_detection (   self,
  instance_module_id = 0,
  force_disable_all_instances = False 
)

Disables the object detection process.

The object detection module immediately stops and frees its memory allocations.

Parameters
instance_module_id: Id of the object detection instance. Used when multiple instances of the object detection module are enabled at the same time.
force_disable_all_instances: Should disable all instances of the object detection module or just instance_module_id.
Note
If the object detection has been enabled, this method will automatically be called by close().

◆ retrieve_objects()

ERROR_CODE retrieve_objects (   self,
Objects  py_objects,
ObjectDetectionRuntimeParameters   object_detection_parameters = ObjectDetectionRuntimeParameters(),
  instance_module_id = 0 
)

Retrieve objects detected by the object detection module.

This method returns the result of the object detection, whether the module is running synchronously or asynchronously.

  • Asynchronous: this method immediately returns the last objects detected. If the current detection isn't done, the objects from the last detection will be returned, and Objects.is_new will be set to False.
  • Synchronous: this method executes detection and waits for it to finish before returning the detected objects.

It is recommended to keep the same Objects object as the input of all calls to this method. This will enable the identification and tracking of every object detected.

Parameters
py_objects[out]: The detected objects will be saved into this object. If the object already contains data from a previous detection, it will be updated, keeping a unique ID for the same person.
object_detection_parameters[in]: Object detection runtime settings, can be changed at each detection. In async mode, the parameters update is applied on the next iteration.
instance_module_id: Id of the object detection instance. Used when multiple instances of the object detection module are enabled at the same time.
Returns
ERROR_CODE.SUCCESS if everything went fine, ERROR_CODE.FAILURE otherwise.
objects = sl.Objects()
while True:
if zed.grab() == sl.ERROR_CODE.SUCCESS:
zed.retrieve_objects(objects)
object_list = objects.object_list
for i in range(len(object_list)):
print(repr(object_list[i].label))

◆ get_objects_batch()

ERROR_CODE get_objects_batch (   self,
list[ObjectsBatch trajectories,
  instance_module_id = 0 
)

Get a batch of detected objects.

Warning
This method needs to be called after retrieve_objects, otherwise trajectories will be empty.
It is the retrieve_objects method that ingest the current/live objects into the batching queue.
Parameters
trajectories: list of sl.ObjectsBatch that will be filled by the batching queue process. An empty list should be passed to the function
instance_module_id: Id of the object detection instance. Used when multiple instances of the object detection module are enabled at the same time.
Returns
ERROR_CODE.SUCCESS if everything went fine
ERROR_CODE.INVALID_FUNCTION_CALL if batching module is not available (TensorRT!=7.1) or if object tracking was not enabled.
Note
Most of the time, the vector will be empty and will be filled every BatchParameters.latency.
objects = sl.Objects() # Unique Objects to be updated after each grab
while True: # Main loop
if zed.grab() == sl.ERROR_CODE.SUCCESS: # Grab an image from the camera
zed.retrieve_objects(objects) # Call retrieve_objects so that objects are ingested in the batching system
trajectories = [] # Create an empty list of trajectories
zed.get_objects_batch(trajectories) # Get batch of objects
print("Size of batch: {}".format(len(trajectories)))

◆ ingest_custom_box_objects()

ERROR_CODE ingest_custom_box_objects (   self,
list[CustomBoxObjectData objects_in,
  instance_module_id = 0 
)

Feed the 3D Object tracking function with your own 2D bounding boxes from your own detection algorithm.

Parameters
objects_in: List of CustomBoxObjectData to feed the object detection.
instance_module_id: Id of the object detection instance. Used when multiple instances of the object detection module are enabled at the same time.
Returns
ERROR_CODE.SUCCESS if everything went fine.
Note
The detection should be done on the current grabbed left image as the internal process will use all currently available data to extract 3D information and perform object tracking.

◆ get_sdk_version()

str get_sdk_version ( )
static

Returns the version of the currently installed ZED SDK.

Returns
The ZED SDK version as a string with the following format: MAJOR.MINOR.PATCH
print(sl.Camera.get_sdk_version())

◆ get_device_list()

list[DeviceProperties] get_device_list ( )
static

List all the connected devices with their associated information.

This method lists all the cameras available and provides their serial number, models and other information.

Returns
The device properties for each connected camera.

◆ get_streaming_device_list()

list[StreamingProperties] get_streaming_device_list ( )
static

Lists all the streaming devices with their associated information.

Returns
The streaming properties for each connected camera.
Warning
This method takes around 2 seconds to make sure all network informations has been captured. Make sure to run this method in a thread.

◆ reboot()

ERROR_CODE reboot ( int  sn,
bool   full_reboot = True 
)
static

Performs a hardware reset of the ZED 2 and the ZED 2i.

Parameters
sn: Serial number of the camera to reset, or 0 to reset the first camera detected.
full_reboot: Perform a full reboot (sensors and video modules) if True, otherwise only the video module will be rebooted.
Returns
ERROR_CODE::SUCCESS if everything went fine.
ERROR_CODE::CAMERA_NOT_DETECTED if no camera was detected.
ERROR_CODE::FAILURE otherwise.
Note
This method only works for ZED 2, ZED 2i, and newer camera models.
Warning
This method will invalidate any sl.Camera object, since the device is rebooting.