This class serves as the primary interface between the camera and the various features provided by the SDK when using Monocular cameras. More...
Functions | |
| None | close (self) |
| Close an opened camera. More... | |
| ERROR_CODE | open (self, InitParametersOne py_init=None) |
| Opens the ZED camera from the provided InitParametersOne. More... | |
| bool | is_opened (self) |
| Reports if the camera has been successfully opened. More... | |
| ERROR_CODE | grab (self) |
| 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, mem_type=MEM.CPU, Resolution, resolution=None) |
| Retrieves images from the camera (or SVO file). More... | |
| def | retrieve_tensor (self, Tensor, dest, TensorParameters, params) |
| Retrieved a sl::Tensor, containing the input image pre-processed for inference with SVO or live camera. More... | |
| def | get_camera_settings_range (self, VIDEO_SETTINGS settings) |
| Get the range for the specified camera settings VIDEO_SETTINGS as min/max value. More... | |
| def | get_svo_position_at_timestamp (self, Timestamp, timestamp) |
| Retrieves the frame index within the SVO file corresponding to the provided timestamp. More... | |
| ERROR_CODE | set_svo_position (self, int, position) |
| Sets the playback cursor to the desired position 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 (self, VIDEO_SETTINGS settings, value=-1) |
| Sets the value of the requested camera setting (gain, brightness, hue, exposure, etc.). More... | |
| ERROR_CODE | set_camera_settings_range (self, VIDEO_SETTINGS settings, value_min=-1, value_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, reset=False) |
| Overloaded method for VIDEO_SETTINGS.AEC_AGC_ROI which takes a Rect as parameter. More... | |
| tuple(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... | |
| tuple(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) |
| 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... | |
| CameraOneInformation | get_camera_information (self, resizer=None) |
| Not implemented. More... | |
| InitParametersOne | get_init_parameters (self) |
| Returns the InitParametersOne associated with the Camera object. More... | |
| StreamingParameters | get_streaming_parameters (self) |
| Returns the StreamingParameters used. More... | |
| ERROR_CODE | get_sensors_data (self, SensorsData, py_sensor_data, time_reference=TIME_REFERENCE.CURRENT) |
| Retrieves the SensorsData (IMU, magnetometer, barometer) at a specific time reference. More... | |
| ERROR_CODE | get_sensors_data_batch (self, list, py_sensor_data) |
| Retrieves all SensorsData (IMU only) associated to most recent grabbed frame in the specified COORDINATE_SYSTEM of InitParameters. More... | |
| ERROR_CODE | enable_streaming (self, streaming_parameters=None) |
| 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... | |
Static Functions | |
| list[DeviceProperties] | get_device_list () |
| List all the connected devices with their associated information. More... | |
| list[StreamingProperties] | get_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... | |
| ERROR_CODE | reboot_from_input (INPUT_TYPE input_type) |
| Performs a hardware reset of all devices matching the InputType. More... | |
This class serves as the primary interface between the camera and the various features provided by the SDK when using Monocular cameras.
A standard program will use the Camera class like this:
| 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.
| ERROR_CODE open | ( | self, | |
| InitParametersOne | py_init = None |
||
| ) |
Opens the ZED camera from the provided InitParametersOne.
The method will also check the hardware requirements and run a self-calibration.
| py_init | : A structure containing all the initial parameters. Default: a preset of InitParametersOne. |
Here is the proper way to call this function:
| 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.
| ERROR_CODE grab | ( | self | ) |
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.
str().| ERROR_CODE retrieve_image | ( | self, | |
| Mat, | |||
| py_mat, | |||
view = VIEW.LEFT, |
|||
mem_type = MEM.CPU, |
|||
| Resolution, | |||
resolution = None |
|||
| ) |
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.
| py_mat[out] | : The sl.Mat to store the image. |
| view[in] | : Defines the image you want (see VIEW). Default: VIEW.LEFT. |
| mem_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). |
| def retrieve_tensor | ( | self, | |
| Tensor, | |||
| dest, | |||
| TensorParameters, | |||
| params | |||
| ) |
Retrieved a sl::Tensor, containing the input image pre-processed for inference with SVO or live camera.
This method provides a way to obtain the pre-processed input image in a format suitable for deep learning inference tasks. The retrieved Tensor is allocated on the GPU, allowing for efficient processing and integration with deep learning frameworks.
The pre-processing steps applied to the input image include resizing, normalization, and any other transformations required to prepare the image for inference.
This method is particularly useful when working with deep learning models that require specific input formats and pre-processing steps. By retrieving the pre-processed Tensor directly from the Camera class, users can streamline their workflow and ensure compatibility with their deep learning pipelines.
| dest | : The Tensor to store the pre-processed input image for inference. |
| params | : Options to configure the pre-processing steps applied to the input image. |
| def get_camera_settings_range | ( | self, | |
| VIDEO_SETTINGS | settings | ||
| ) |
Get the range for the specified camera settings VIDEO_SETTINGS as min/max value.
| settings | : Must be set at a valid VIDEO_SETTINGS that accepts a min/max range and available for the current camera model. |
| min | : The minimum value that can be reached to be fill. |
| max | : The maximum value that can be reached to be fill. |
Referenced by CameraOne.get_camera_settings_range().
| def get_svo_position_at_timestamp | ( | self, | |
| Timestamp, | |||
| timestamp | |||
| ) |
Retrieves the frame index within the SVO file corresponding to the provided timestamp.
| timestamp | The target timestamp for which the frame index is to be determined. |
| ERROR_CODE set_svo_position | ( | self, | |
| int, | |||
| position | |||
| ) |
Sets the playback cursor to the desired position 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 position.
| position | : The position in the SVO file. |
| 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 InitParametersOne.svo_real_time_mode).
See set_svo_position() for an example.
| int get_svo_number_of_frames | ( | self | ) |
Returns the number of frames in the SVO file.
The method works only if the camera is open in SVO playback mode.
| ERROR_CODE ingest_data_into_svo | ( | self, | |
| SVOData | data | ||
| ) |
ingest a SVOData in the SVO file.
The method works only if the camera is open in SVO recording mode.
| list get_svo_data_keys | ( | self | ) |
Get the external channels that can be retrieved from the SVO file.
The method works only if the camera is open in SVO playback mode.
| 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.
| 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.
| ERROR_CODE set_camera_settings | ( | self, | |
| VIDEO_SETTINGS | settings, | ||
value = -1 |
|||
| ) |
Sets the value of the requested camera setting (gain, brightness, hue, exposure, etc.).
This method only applies for VIDEO_SETTINGS that require a single value.
Possible values (range) of each settings are available here.
| settings | : The setting to be set. |
| value | : The value to set. Default: auto mode |
| ERROR_CODE set_camera_settings_range | ( | self, | |
| VIDEO_SETTINGS | settings, | ||
value_min = -1, |
|||
value_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:
| 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). |
| ERROR_CODE set_camera_settings_roi | ( | self, | |
| VIDEO_SETTINGS | settings, | ||
| Rect | roi, | ||
reset = False |
|||
| ) |
Overloaded method for VIDEO_SETTINGS.AEC_AGC_ROI which takes a Rect as parameter.
| 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. |
| reset | : Cancel the manual ROI and reset it to the full image. Default: False |
| tuple(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.
| setting | : The requested setting. |
| tuple(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.
| setting | : The requested setting. |
| ERROR_CODE get_camera_settings_roi | ( | self, | |
| VIDEO_SETTINGS | setting, | ||
| Rect | roi | ||
| ) |
Returns the current value of the currently used ROI for the camera setting AEC_AGC_ROI.
| 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. |
| bool is_camera_setting_supported | ( | self, | |
| VIDEO_SETTINGS | setting | ||
| ) |
Returns if the video setting is supported by the camera or not.
| setting[in] | : the video setting to test |
| 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.
| Timestamp get_timestamp | ( | self, | |
| TIME_REFERENCE | time_reference | ||
| ) |
Returns the timestamp in the requested TIME_REFERENCE.
This function can also be used when playing back an SVO file.
| time_reference | : The selected TIME_REFERENCE. |
| 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).
| CameraOneInformation get_camera_information | ( | self, | |
resizer = None |
|||
| ) |
Not implemented.
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.
| 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). |
| InitParametersOne get_init_parameters | ( | self | ) |
Returns the InitParametersOne associated with the Camera object.
It corresponds to the structure given as argument to open() method.
| StreamingParameters get_streaming_parameters | ( | self | ) |
Returns the StreamingParameters used.
It corresponds to the structure given as argument to the enable_streaming() method.
| ERROR_CODE get_sensors_data | ( | self, | |
| SensorsData, | |||
| py_sensor_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
| py_sensor_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. |
| ERROR_CODE get_sensors_data_batch | ( | self, | |
| list, | |||
| py_sensor_data | |||
| ) |
Retrieves all SensorsData (IMU only) associated to most recent grabbed frame in the specified COORDINATE_SYSTEM of InitParameters.
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
| py_sensor_data[out] | : The SensorsData list to store the data. |
| ERROR_CODE enable_streaming | ( | self, | |
streaming_parameters = None |
|||
| ) |
Creates a streaming pipeline.
| streaming_parameters | : A structure containing all the specific parameters for the streaming. Default: a reset of StreamingParameters . |
| None disable_streaming | ( | self | ) |
Disables the streaming initiated by enable_streaming().
See enable_streaming() for an example.
| bool is_streaming_enabled | ( | self | ) |
Tells if the streaming is running.
| 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.
| record | : A structure containing all the specific parameters for the recording such as filename and compression mode. Default: a reset of RecordingParameters . |
| None disable_recording | ( | self | ) |
Disables the recording initiated by enable_recording() and closes the generated file.
See enable_recording() for an example.
| RecordingStatus get_recording_status | ( | self | ) |
Get the recording information.
| None pause_recording | ( | self, | |
value = True |
|||
| ) |
Pauses or resumes the recording.
| status | : If True, the recording is paused. If False, the recording is resumed. |
|
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.
|
static |
Lists all the streaming devices with their associated information.
|
static |
Performs a hardware reset of the ZED 2 and the ZED 2i.
| 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. |
|
static |
Performs a hardware reset of all devices matching the InputType.
| input_type | : Input type of the devices to reset. |