InitParameters Class Reference

Holds the options used to initialize the Camera object. More...

Functions

def __cinit__ (self, camera_resolution=RESOLUTION.HD720, camera_fps=0, svo_real_time_mode=False, depth_mode=DEPTH_MODE.PERFORMANCE, coordinate_units=UNIT.MILLIMETER, coordinate_system=COORDINATE_SYSTEM.IMAGE, sdk_verbose=0, sdk_gpu_id=-1, depth_minimum_distance=-1.0, depth_maximum_distance=-1.0, camera_disable_self_calib=False, camera_image_flip=FLIP_MODE.AUTO, enable_right_side_measure=False, sdk_verbose_log_file="", depth_stabilization=1, input_t=InputType(), optional_settings_path="", sensors_required=False, enable_image_enhancement=True, optional_opencv_calibration_file="", open_timeout_sec=5.0)
 Constructor. More...
 
def save (self, str filename)
 This function saves the current set of parameters into a file to be reloaded with the load() function. More...
 
def load (self, str filename)
 This function sets the other parameters from the values contained in a previously saved file. More...
 
def camera_resolution (self)
 Defines the chosen camera resolution. More...
 
def camera_fps (self)
 Requested camera frame rate. More...
 
def sensors_required (self)
 Force the motion sensors opening of the ZED 2 / ZED-M to open the camera. More...
 
def svo_real_time_mode (self)
 When playing back an SVO file, each call to Camera.grab() will extract a new frame and use it. More...
 
def depth_mode (self)
 The SDK offers several DEPTH_MODE options offering various levels of performance and accuracy. More...
 
def coordinate_units (self)
 This parameter allows you to select the unit to be used for all metric values of the SDK. More...
 
def coordinate_system (self)
 Positional tracking, point clouds and many other features require a given COORDINATE_SYSTEM to be used as reference. More...
 
def sdk_verbose (self)
 This parameter allows you to enable the verbosity of the SDK to get a variety of runtime information in the console. More...
 
def sdk_gpu_id (self)
 By default the SDK will use the most powerful NVIDIA graphics card found. More...
 
def depth_minimum_distance (self)
 This parameter allows you to specify the minimum depth value (from the camera) that will be computed, measured in the UNIT you define. More...
 
def depth_maximum_distance (self)
 Defines the current maximum distance that can be computed in the defined UNIT. More...
 
def camera_disable_self_calib (self)
 At initialization, the Camera runs a self-calibration process that corrects small offsets from the device's factory calibration. More...
 
def camera_image_flip (self)
 If you are using the camera upside down, setting this parameter to FLIP_MODE.ON will cancel its rotation. More...
 
def enable_right_side_measure (self)
 By default, the SDK only computes a single depth map, aligned with the left camera image. More...
 
def sdk_verbose_log_file (self)
 When sdk_verbose is enabled, this parameter allows you to redirect both the SDK verbose messages and your own application messages to a file. More...
 
def depth_stabilization (self)
 Regions of the generated depth map can oscillate from one frame to another. More...
 
def optional_settings_path (self)
 Set the optional path where the SDK has to search for the settings file (SN<XXXX>.conf file). More...
 
def optional_opencv_calibration_file (self)
 Set an optional file path where the SDK can find a file containing the calibration information of the camera computed by OpenCV. More...
 
def open_timeout_sec (self)
 Defines a timeout in seconds after which an error is reported if the sl.Camera.open() command fails. More...
 
def set_from_camera_id (self, uint id)
 Call of InputType.set_from_camera_id function of input. More...
 
def set_from_serial_number (self, uint serial_number)
 Call of InputType.set_from_serial_number function of input. More...
 
def set_from_svo_file (self, str svo_input_filename)
 Call of InputType.set_from_svo_file function of input. More...
 
def set_from_stream (self, str sender_ip, port=30000)
 Call of InputType.set_from_stream function of input. More...
 

Detailed Description

Holds the options used to initialize the Camera object.

Once passed to the Camera.open() function, these settings will be set for the entire execution life time of the Camera. You can get further information in the detailed description bellow.

This structure allows you to select multiple parameters for the Camera such as the selected camera, its resolution, depth mode, coordinate system, and unit, of measurement. Once filled with the desired options, it should be passed to the Camera.open() function.

import pyzed.sl as sl
def main() :
zed = sl.Camera() # Create a ZED camera object
init_params = sl.InitParameters() # Set initial parameters
init_params.sdk_verbose = 0 # Disable verbose mode
init_params.camera_resolution = sl.RESOLUTION.HD1080 # Use HD1080 video mode
init_params.camera_fps = 30 # Set fps at 30
# Other parameters are left to their default values
# Open the camera
err = zed.open(init_params)
if err != sl.ERROR_CODE.SUCCESS :
exit(-1)
# Close the camera
zed.close()
return 0
if __name__ == "__main__" :
main()
Definition: sl.pyx:1

With its default values, it opens the ZED camera in live mode at RESOLUTION.HD720 and sets the depth mode to DEPTH_MODE.PERFORMANCE You can customize it to fit your application. The parameters can also be saved and reloaded using its save() and load() functions.

Functions

◆ __cinit__()

def __cinit__ (   self,
  camera_resolution = RESOLUTION.HD720,
  camera_fps = 0,
  svo_real_time_mode = False,
  depth_mode = DEPTH_MODE.PERFORMANCE,
  coordinate_units = UNIT.MILLIMETER,
  coordinate_system = COORDINATE_SYSTEM.IMAGE,
  sdk_verbose = 0,
  sdk_gpu_id = -1,
  depth_minimum_distance = -1.0,
  depth_maximum_distance = -1.0,
  camera_disable_self_calib = False,
  camera_image_flip = FLIP_MODE.AUTO,
  enable_right_side_measure = False,
  sdk_verbose_log_file = "",
  depth_stabilization = 1,
  input_t = InputType(),
  optional_settings_path = "",
  sensors_required = False,
  enable_image_enhancement = True,
  optional_opencv_calibration_file = "",
  open_timeout_sec = 5.0 
)

Constructor.

Parameters
camera_resolution: the chosen camera_resolution
camera_fps: the chosen camera_fps
svo_real_time_mode: activates svo_real_time_mode
depth_mode: the chosen depth_mode
coordinate_units: the chosen coordinate_units
coordinate_system: the chosen coordinate_system
sdk_verbose: sets sdk_verbose
sdk_gpu_id: the chosen sdk_gpu_id
depth_minimum_distance: the chosen depth_minimum_distance
depth_maximum_distance: the chosen depth_maximum_distance
camera_disable_self_calib: activates camera_disable_self_calib
camera_image_flip: sets camera_image_flip
enable_right_side_measure: activates enable_right_side_measure
sdk_verbose_log_file: the chosen sdk_verbose_log_file
depth_stabilization: activates depth_stabilization
input_t: the chosen input_t (InputType )
optional_settings_path: the chosen optional_settings_path
sensors_required: activates sensors_required
enable_image_enhancement: activates enable_image_enhancement
optional_opencv_calibration_file: sets optional_opencv_calibration_file
open_timeout_sec: sets open_timeout_sec
params = sl.InitParameters(camera_resolution=RESOLUTION.HD720, camera_fps=30, depth_mode=DEPTH_MODE.PERFORMANCE)

◆ save()

def save (   self,
str  filename 
)

This function saves the current set of parameters into a file to be reloaded with the load() function.

Parameters
filename: the path to the file in which the parameters will be stored
Returns
True if file was successfully saved, otherwise false.
init_params = sl.InitParameters() # Set initial parameters
init_params.sdk_verbose = 1 # Enable verbose mode
init_params.set_from_svo_file("/path/to/file.svo") # Selects the and SVO file to be read
init_params.save("initParameters.conf") # Export the parameters into a file

◆ load()

def load (   self,
str  filename 
)

This function sets the other parameters from the values contained in a previously saved file.

Parameters
filename: the path to the file from which the parameters will be loaded.
Returns
True if the file was successfully loaded, otherwise false.
init_params = sl.InitParameters() # Set initial parameters
init_params.load("initParameters.conf") # Load the init_params from a previously exported file

◆ camera_resolution()

def camera_resolution (   self)

Defines the chosen camera resolution.

Small resolutions offer higher framerate and lower computation time. In most situations, the RESOLUTION.HD720 at 60 fps is the best balance between image quality and framerate. Available resolutions are listed here: RESOLUTION

◆ camera_fps()

def camera_fps (   self)

Requested camera frame rate.

If set to 0, the highest FPS of the specified InitParameters.camera_resolution will be used. See RESOLUTION for a list of supported framerates. default 0

Note
If the requested camera_fps is unsupported, the closest available FPS will be used.

Referenced by CameraInformation.__cinit__(), CameraConfiguration.camera_fps(), and CameraInformation.camera_fps().

◆ sensors_required()

def sensors_required (   self)

Force the motion sensors opening of the ZED 2 / ZED-M to open the camera.

default : false If set to false, the SDK will try to open and use the IMU (second USB device on USB2.0) and will open the camera successfully even if the sensors failed to open. This can be used for example when using a USB3.0 only extension cable (some fiber extension for example). This parameter only impacts the LIVE mode. If set to true, the camera will fail to open if the sensors cannot be opened. This parameter should be used when the IMU data must be available, such as Object Detection module or when the gravity is needed.

◆ svo_real_time_mode()

def svo_real_time_mode (   self)

When playing back an SVO file, each call to Camera.grab() will extract a new frame and use it.

However, this 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. However, calls to Camera.grab() will return an error when trying to play too fast, and frames will be dropped when playing too slowly.

◆ depth_mode()

def depth_mode (   self)

The SDK offers several DEPTH_MODE options offering various levels of performance and accuracy.

This parameter allows you to set the DEPTH_MODE that best matches your needs. default DEPTH_MODE.PERFORMANCE

◆ coordinate_units()

def coordinate_units (   self)

This parameter allows you to select the unit to be used for all metric values of the SDK.

(depth, point cloud, tracking, mesh, and others). default : UNIT.MILLIMETER

◆ coordinate_system()

def coordinate_system (   self)

Positional tracking, point clouds and many other features require a given COORDINATE_SYSTEM to be used as reference.

This parameter allows you to select the COORDINATE_SYSTEM use by the Camera to return its measures. default : COORDINATE_SYSTEM.IMAGE

◆ sdk_verbose()

def sdk_verbose (   self)

This parameter allows you to enable the verbosity of the SDK to get a variety of runtime information in the console.

When developing an application, enabling verbose mode (sdk_verbose >= 1) can help you understand the current SDK behavior. However, this might not be desirable in a shipped version. default : 0 = no verbose message

Note
The verbose messages can also be exported into a log file. See sdk_verbose_log_file for more

◆ sdk_gpu_id()

def sdk_gpu_id (   self)

By default the SDK will use the most powerful NVIDIA graphics card found.

However, when running several applications, or using several cameras at the same time, splitting the load over available GPUs can be useful. This parameter allows you to select the GPU used by the Camera using an ID from 0 to n-1 GPUs in your PC. default : -1

Note
A non-positive value will search for all CUDA capable devices and select the most powerful.

◆ depth_minimum_distance()

def depth_minimum_distance (   self)

This parameter allows you to specify the minimum depth value (from the camera) that will be computed, measured in the UNIT you define.

In stereovision (the depth technology used by the camera), looking for closer depth values can have a slight impact on performance. However, this difference is almost invisible on modern GPUs. In cases of limited computational power, increasing this value can provide better performance. default : (-1) corresponding to 700 mm for a ZED/ZED2 and 200 mm for ZED Mini.

Note
With a ZED camera you can decrease this value to 300 mm whereas you can set it to 100 mm using a ZED Mini and 200 mm for a ZED2. In any case this value cannot be greater than 3 meters. Specific value (0): This will set the depth minimum distance to the minimum authorized value :
  • 300mm for ZED
  • 100mm for ZED-M
  • 200mm for ZED2

◆ depth_maximum_distance()

def depth_maximum_distance (   self)

Defines the current maximum distance that can be computed in the defined UNIT.

When estimating the depth, the SDK uses this upper limit to turn higher values into TOO_FAR ones (unavailable depth values).

Note
Changing this value has no impact on performance and doesn't affect the positional tracking nor the spatial mapping. (Only the depth, point cloud, normals)

◆ camera_disable_self_calib()

def camera_disable_self_calib (   self)

At initialization, the Camera runs a self-calibration process that corrects small offsets from the device's factory calibration.

A drawback is that calibration parameters will sligtly change from one (live) run to another, which can be an issue for repeatability. If set to true, self-calibration will be disabled and calibration parameters won't be optimized (using the parameters of the conf file). default : false

Note
In most situations, self calibration should remain enabled.

◆ camera_image_flip()

def camera_image_flip (   self)

If you are using the camera upside down, setting this parameter to FLIP_MODE.ON will cancel its rotation.

The images will be horizontally flipped. default : FLIP_MODE.AUTO

◆ enable_right_side_measure()

def enable_right_side_measure (   self)

By default, the SDK only computes a single depth map, aligned with the left camera image.

This parameter allows you to enable the DEPTH.DEPTH_RIGHT and other <XXX>.RIGHT at the cost of additional computational time. For example, mixed reality passthrough applications require one depth map per eye, so this parameter can be activated. default : false

◆ sdk_verbose_log_file()

def sdk_verbose_log_file (   self)

When sdk_verbose is enabled, this parameter allows you to redirect both the SDK verbose messages and your own application messages to a file.

default : (empty) Should contain the path to the file to be written. A file will be created if missing.

Note
Setting this parameter to any value will redirect all standard output print calls of the entire program. This means that your own standard output print calls will be redirected to the log file.
Warning
The log file won't be cleared after successive executions of the application. This means that it can grow indefinitely if not cleared.

◆ depth_stabilization()

def depth_stabilization (   self)

Regions of the generated depth map can oscillate from one frame to another.

These oscillations result from a lack of texture (too homogeneous) on an object and by image noise. This parameter control a stabilization filter that reduces these oscillations. In the range [0-100], 0 is disable (raw depth), smoothness is linear from 1 to 100.

Note
The stabilization uses the positional tracking to increase its accuracy, so the Positional Tracking module will be enabled automatically when set to a value different from 0

◆ optional_settings_path()

def optional_settings_path (   self)

Set the optional path where the SDK has to search for the settings file (SN<XXXX>.conf file).

This file contains the calibration information of the camera.

default : (empty). The SNXXX.conf file will be searched in the default directory (/usr/local/zed/settings/ for Linux or C:/ProgramData/stereolabs/settings for Windows)

Note
if a path is specified and no file has been found, the SDK will search on the default path (see default) for the *.conf file.

Automatic download of conf file (through ZED Explorer or the installer) will still download the file in the default path. If you want to use another path by using this entry, make sure to copy the file in the proper location.

init_params = sl.InitParameters() # Set initial parameters
home = "/path/to/home"
path= home+"/Documents/settings/" # assuming /path/to/home/Documents/settings/SNXXXX.conf exists. Otherwise, it will be searched in /usr/local/zed/settings/
init_params.optional_settings_path = path

◆ optional_opencv_calibration_file()

def optional_opencv_calibration_file (   self)

Set an optional file path where the SDK can find a file containing the calibration information of the camera computed by OpenCV.

Note
Using this will disable the factory calibration of the camera.
Warning
Erroneous calibration values can lead to poor SDK modules accuracy.

◆ open_timeout_sec()

def open_timeout_sec (   self)

Defines a timeout in seconds after which an error is reported if the sl.Camera.open() command 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.0f

Note
This parameter only impacts the LIVE mode.

◆ set_from_camera_id()

def set_from_camera_id (   self,
uint  id 
)

Call of InputType.set_from_camera_id function of input.

Parameters
id: The desired camera ID

◆ set_from_serial_number()

def set_from_serial_number (   self,
uint  serial_number 
)

Call of InputType.set_from_serial_number function of input.

Parameters
serial_number: The desired camera serial_number

◆ set_from_svo_file()

def set_from_svo_file (   self,
str  svo_input_filename 
)

Call of InputType.set_from_svo_file function of input.

Parameters
svo_input_filename: The path to the desired SVO file

◆ set_from_stream()

def set_from_stream (   self,
str  sender_ip,
  port = 30000 
)

Call of InputType.set_from_stream function of input.

Parameters
sender_ip: The IP address of the streaming sender
port: The port on which to listen. Default: 30000