Class containing the options used to initialize the sl.CameraOne object. More...
Functions | |
RESOLUTION | camera_resolution (self) |
Default constructor. More... | |
int | camera_fps (self) |
Requested camera frame rate. More... | |
bool | svo_real_time_mode (self) |
Defines if sl.Camera object return the frame in real time mode. More... | |
UNIT | coordinate_units (self) |
Unit of spatial data (depth, point cloud, tracking, mesh, etc.) for retrieval. More... | |
COORDINATE_SYSTEM | coordinate_system (self) |
sl.COORDINATE_SYSTEM to be used as reference for positional tracking, mesh, point clouds, etc. More... | |
int | sdk_verbose (self) |
Enable the ZED SDK verbose mode. More... | |
str | sdk_verbose_log_file (self) |
File path to store the ZED SDK logs (if sdk_verbose is enabled). More... | |
str | optional_settings_path (self) |
Optional path where the ZED SDK has to search for the settings file (SN<XXXX>.conf file). More... | |
float | open_timeout_sec (self) |
Define a timeout in seconds after which an error is reported if the sl.Camera.open() method fails. More... | |
bool | async_grab_camera_recovery (self) |
Define the behavior of the automatic camera recovery during sl.Camera.grab() method call. More... | |
None | set_from_camera_id (self, uint id, BUS_TYPE bus_type=BUS_TYPE.AUTO) |
Defines the input source with a camera id to initialize and open an sl.Camera object from. More... | |
None | set_from_serial_number (self, uint serial_number, BUS_TYPE bus_type=BUS_TYPE.AUTO) |
Defines the input source with a serial number to initialize and open an sl.Camera object from. More... | |
None | set_from_svo_file (self, str svo_input_filename) |
Defines the input source with an SVO file to initialize and open an sl.Camera object from. More... | |
None | set_from_stream (self, str sender_ip, port=30000) |
Defines the input source from a stream to initialize and open an sl.Camera object from. More... | |
None | close (self) |
Close an opened camera. More... | |
ERROR_CODE | open (self, InitParametersOne py_init=InitParametersOne()) |
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, type=MEM.CPU, resolution=Resolution(0, 0)) |
Retrieves images from the camera (or SVO file). 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 | 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... | |
(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) |
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... | |
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_sensors_data, time_reference=TIME_REFERENCE.CURRENT) |
Retrieves the SensorsData (IMU, magnetometer, barometer) at a specific time reference. 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... | |
Static Functions | |
list[DeviceProperties] | get_device_list () |
List all the connected 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... | |
Class containing the options used to initialize the sl.CameraOne object.
This class allows you to select multiple parameters for the sl.Camera such as the selected camera, resolution, depth mode, coordinate system, and units of measurement.
Once filled with the desired options, it should be passed to the sl.Camera.open() method.
With its default values, it opens the camera in live mode at sl.RESOLUTION.HD720
You can customize it to fit your application.
RESOLUTION camera_resolution | ( | self | ) |
Default constructor.
All the parameters are set to their default and optimized values.
camera_resolution | : Chosen camera_resolution |
camera_fps | : Chosen camera_fps |
svo_real_time_mode | : Activates svo_real_time_mode |
coordinate_units | : Chosen coordinate_units |
coordinate_system | : Chosen coordinate_system |
sdk_verbose | : Sets sdk_verbose |
sdk_verbose_log_file | : Chosen sdk_verbose_log_file |
input_t | : Chosen input_t (InputType ) |
optional_settings_path | : Chosen optional_settings_path |
sensors_required | : Activates sensors_required |
optional_opencv_calibration_file | : Sets optional_opencv_calibration_file |
open_timeout_sec | : Sets open_timeout_sec |
async_grab_camera_recovery | : Sets async_grab_camera_recovery |
grab_compute_capping_fps | : Sets grab_compute_capping_fps |
enable_image_validity_check | : Sets enable_image_validity_check |
Desired camera resolution.
Default:
int camera_fps | ( | self | ) |
Requested camera frame rate.
If set to 0, the highest FPS of the specified camera_resolution will be used.
Default: 0
See sl.RESOLUTION for a list of supported frame rates.
Referenced by CameraConfiguration.fps().
bool svo_real_time_mode | ( | self | ) |
Defines if sl.Camera object return the frame in real time mode.
When playing back an SVO file, each call to sl.Camera.grab() will extract a new frame and use it.
However, it ignores the real capture rate of the images saved in the SVO file.
Enabling this parameter will bring the SDK closer to a real simulation when playing back a file by using the images' timestamps.
Default: False
UNIT coordinate_units | ( | self | ) |
Unit of spatial data (depth, point cloud, tracking, mesh, etc.) for retrieval.
Default: sl.UNIT.MILLIMETER
COORDINATE_SYSTEM coordinate_system | ( | self | ) |
sl.COORDINATE_SYSTEM to be used as reference for positional tracking, mesh, point clouds, etc.
This parameter allows you to select the sl.COORDINATE_SYSTEM used by the sl.Camera object to return its measures.
This defines the order and the direction of the axis of the coordinate system.
Default: sl.COORDINATE_SYSTEM.IMAGE
int sdk_verbose | ( | self | ) |
Enable the ZED SDK verbose mode.
This parameter allows you to enable the verbosity of the ZED SDK to get a variety of runtime information in the console.
When developing an application, enabling verbose (sdk_verbose >= 1
) mode can help you understand the current ZED SDK behavior.
However, this might not be desirable in a shipped version.
Default: 0 (no verbose message)
str sdk_verbose_log_file | ( | self | ) |
File path to store the ZED SDK logs (if sdk_verbose is enabled).
The file will be created if it does not exist.
Default: ""
str optional_settings_path | ( | self | ) |
Optional path where the ZED SDK has to search for the settings file (SN<XXXX>.conf file).
This file contains the calibration information of the camera.
Default: ""
float open_timeout_sec | ( | self | ) |
Define a timeout in seconds after which an error is reported if the sl.Camera.open() method fails.
Set to '-1' to try to open the camera endlessly without returning error in case of failure.
Set to '0' to return error in case of failure at the first attempt.
Default: 5.0
bool async_grab_camera_recovery | ( | self | ) |
Define the behavior of the automatic camera recovery during sl.Camera.grab() method call.
When async is enabled and there's an issue with the communication with the sl.Camera object, sl.Camera.grab() will exit after a short period and return the sl.ERROR_CODE.CAMERA_REBOOTING warning.
The recovery will run in the background until the correct communication is restored.
When async_grab_camera_recovery is false, the sl.Camera.grab() method is blocking and will return only once the camera communication is restored or the timeout is reached.
Default: False
None set_from_camera_id | ( | self, | |
uint | id, | ||
BUS_TYPE | bus_type = BUS_TYPE.AUTO |
||
) |
Defines the input source with a camera id to initialize and open an sl.Camera object from.
id | : Id of the desired camera to open. |
bus_type | : sl.BUS_TYPE of the desired camera to open. |
None set_from_serial_number | ( | self, | |
uint | serial_number, | ||
BUS_TYPE | bus_type = BUS_TYPE.AUTO |
||
) |
Defines the input source with a serial number to initialize and open an sl.Camera object from.
serial_number | : Serial number of the desired camera to open. |
bus_type | : sl.BUS_TYPE of the desired camera to open. |
None set_from_svo_file | ( | self, | |
str | svo_input_filename | ||
) |
Defines the input source with an SVO file to initialize and open an sl.Camera object from.
svo_input_filename | : Path to the desired SVO file to open. |
None set_from_stream | ( | self, | |
str | sender_ip, | ||
port = 30000 |
|||
) |
Defines the input source from a stream to initialize and open an sl.Camera object from.
sender_ip | : IP address of the streaming sender. |
port | : Port on which to listen. Default: 30000 |
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 = InitParametersOne() |
||
) |
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 , |
|||
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.
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). |
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.
frame_number | : The number of the desired frame to be decoded. |
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 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. |
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 |
(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. |
(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. |
eye[in] | : The requested side. Default: SIDE.BOTH |
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).
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_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
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 enable_streaming | ( | self, | |
streaming_parameters = StreamingParameters() |
|||
) |
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 |
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. |