InputType Class Reference

Class defining the input type used in the ZED SDK. More...

Types

enum class  INPUT_TYPE
 Lists input types in the ZED SDK. More...
 

Functions

 InputType ()
 Default constructor. More...
 
 InputType (const InputType &type)=default
 Copy constructor. More...
 
void setFromCameraID (int id=-1, sl::BUS_TYPE bus_type=sl::BUS_TYPE::AUTO)
 Set the input as the camera with specified id. More...
 
void setFromSerialNumber (unsigned int camera_serial_number)
 Set the input as the camera with specified serial number. More...
 
void setFromSVOFile (sl::String svo_input_filename)
 Set the input as the SVO specified with the filename. More...
 
void setFromStream (sl::String sender_ip, unsigned short port=30000)
 Set the input as the stream defined by the IP address and the port of the sending device. More...
 
INPUT_TYPE getType () const
 Returns the current input type. More...
 
sl::String getConfiguration () const
 Returns the current input configuration as a string e.g: SVO name, serial number, streaming ip, etc. More...
 
bool isInit () const
 Check whether the input is set. More...
 
bool setVirtualStereoFromCameraIDs (int id_left, int id_right, unsigned int virtual_serial_number)
 Set the input as the ZED Ones with specified ids for a virtual stereo rig. More...
 
bool setVirtualStereoFromSerialNumbers (unsigned int camera_left_serial_number, unsigned int camera_right_serial_number, unsigned int virtual_serial_number)
 Set the input as the ZED Ones with specified serial numbers for a virtual stereo rig. More...
 
bool save (String filename) const
 Saves the current set of parameters into a file to be reloaded with the load() method. More...
 
bool load (String filename)
 Loads a set of parameters from the values contained in a previously saved file. More...
 
bool encode (String &serialized_content) const
 Generate a JSON Object (with the struct type as a key) containing the serialized struct, converted into a string. More...
 
bool decode (const String &serialized_content)
 Fill the structure from the serialized json object contained in the input string. More...
 
bool operator== (const InputType &param1) const
 Comparison operator ==. More...
 
bool operator!= (const InputType &param1) const
 Comparison operator !=. More...
 

Detailed Description

Class defining the input type used in the ZED SDK.

It can be used to select a specific camera with an id or serial number, or from a SVO file.

Enumeration

◆ INPUT_TYPE

enum INPUT_TYPE
strong

Lists input types in the ZED SDK.

Enumerator
USB_ID 

USB input from an id

USB_SERIAL 

USB input from a serial number

SVO_FILE 

SVO file input

STREAM 

STREAM input (requires to use enableStreaming() / disableStreaming()" on the "sender" side)

GMSL_ID 

GMSL input from an id (only on NVIDIA Jetson)

GMSL_SERIAL 

GMSL input from a serial number (only on NVIDIA Jetson)

AUTO 

AUTO input type, automatically selects the right input type between USB and GMSL

Constructor and Destructor

◆ InputType() [1/2]

InputType ( )

Default constructor.

◆ InputType() [2/2]

InputType ( const InputType type)
default

Copy constructor.

Functions

◆ setFromCameraID()

void setFromCameraID ( int  id = -1,
sl::BUS_TYPE  bus_type = sl::BUS_TYPE::AUTO 
)

Set the input as the camera with specified id.

Note
The id is not related to the serial number of the camera. The id is assigned by the OS depending on the order the cameras are plugged.
Warning
Using id is not recommended if you have multiple cameras plugged in the system, prefer using the serial number instead.
Parameters
id: Id of the camera to open. The default, -1, will open the first available camera. A number >= 0 will try to open the camera with the corresponding id.
bus_type: Whether the camera is a USB or a GMSL camera.

◆ setFromSerialNumber()

void setFromSerialNumber ( unsigned int  camera_serial_number)

Set the input as the camera with specified serial number.

Parameters
camera_serial_number: Serial number of the camera to open.

◆ setFromSVOFile()

void setFromSVOFile ( sl::String  svo_input_filename)

Set the input as the SVO specified with the filename.

Parameters
svo_input_filename: Path of the SVO file to open.

◆ setFromStream()

void setFromStream ( sl::String  sender_ip,
unsigned short  port = 30000 
)

Set the input as the stream defined by the IP address and the port of the sending device.

Parameters
sender_ip: IP address of the streaming sender.
port: Port on which to listen. Default: 30000
Note
The protocol used for the streaming module is based on RTP/RTCP.
Warning
Port must be even number, since the port+1 is used for control data.

◆ getType()

INPUT_TYPE getType ( ) const
inline

Returns the current input type.

◆ getConfiguration()

sl::String getConfiguration ( ) const
inline

Returns the current input configuration as a string e.g: SVO name, serial number, streaming ip, etc.

◆ isInit()

bool isInit ( ) const
inline

Check whether the input is set.

◆ setVirtualStereoFromCameraIDs()

bool setVirtualStereoFromCameraIDs ( int  id_left,
int  id_right,
unsigned int  virtual_serial_number 
)

Set the input as the ZED Ones with specified ids for a virtual stereo rig.

Parameters
id_left: Id of the left ZED One camera to open.
id_right: Id of the right ZED One camera to open.
virtual_serial_number: Serial number of the virtual stereo rig to load its custom calibration
Note
: The virtual serial number must fall within an interval that reflects the Product ID range.
This is necessary to avoid, for instance, downloading calibration data from an unrelated product.
The valid range is 110000000 to 119999999.
A support function can be used, based on the ZED One serial number, to compute a valid virtual serial number: sl::generateVirtualStereoSerialNumber
Returns
error: true if there's an error

◆ setVirtualStereoFromSerialNumbers()

bool setVirtualStereoFromSerialNumbers ( unsigned int  camera_left_serial_number,
unsigned int  camera_right_serial_number,
unsigned int  virtual_serial_number 
)

Set the input as the ZED Ones with specified serial numbers for a virtual stereo rig.

Parameters
camera_left_serial_number: Serial number of the left ZED One camera to open.
camera_right_serial_number: Serial number of the right ZED One camera to open.
virtual_serial_number: Serial number of the virtual stereo rig to load its custom calibration
Note
: The virtual serial number must fall within an interval that reflects the Product ID range.
This is necessary to avoid, for instance, downloading calibration data from an unrelated product.
The valid range is 110000000 to 119999999.
A support function can be used, based on the ZED One serial number, to compute a valid virtual serial number: sl::generateVirtualStereoSerialNumber
Returns
error: true if there's an error

◆ save()

bool save ( String  filename) const

Saves the current set of parameters into a file to be reloaded with the load() method.

Parameters
filename: Name of the file which will be created to store the parameters (extension '.yml' will be added if not set).
Returns
True if file was successfully saved, otherwise false.
Warning
For security reason, the file must not exist.
In case a file already exists, the method will return false and existing file will not be updated.

◆ load()

bool load ( String  filename)

Loads a set of parameters from the values contained in a previously saved file.

Parameters
filename: Path to the file from which the parameters will be loaded (extension '.yml' will be added at the end of the filename if not set).
Returns
True if the file was successfully loaded, otherwise false.
InitParameters init_params; // Set initial parameters
init_params.load("initParameters.yml"); // Load the init_params from a previously exported file
friend struct InitParameters
Definition: types.hpp:956
Note
As the InitParameters files can be easily modified manually (using a text editor) this function allows you to test various settings without re-compiling your application.

◆ encode()

bool encode ( String serialized_content) const

Generate a JSON Object (with the struct type as a key) containing the serialized struct, converted into a string.

Parameters
serialized_contentoutput string containing the JSON Object
Returns
True if file was successfully saved, otherwise false.

◆ decode()

bool decode ( const String serialized_content)

Fill the structure from the serialized json object contained in the input string.

Parameters
serialized_contentinput string containing the JSON Object
Returns
True if the decoding was successful, otherwise false.

◆ operator==()

bool operator== ( const InputType param1) const

Comparison operator ==.

Parameters
param1to compare
Returns
true if the two struct are identical

◆ operator!=()

bool operator!= ( const InputType param1) const

Comparison operator !=.

Parameters
param1to compare
Returns
true if the two struct are different