51#include <opencv2/core/mat.hpp>
54#if !defined(MULTISENSE_API)
56#define MULTISENSE_API __declspec(dllexport)
66using TimeT = std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>;
131 std::array<std::array<float, 3>, 3>
K{{{0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}}};
137 std::array<std::array<float, 3>, 3>
R{{{0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}}};
143 std::array<std::array<float, 4>, 3>
P{{{0.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 0.0f}}};
153 std::vector<float>
D = {};
161 return std::array<float, 3>{(
P[0][0] == 0.0f ? 0.0f :
P[0][3] /
P[0][0]),
162 (
P[1][1] == 0.0f ? 0.0f :
P[1][3] /
P[1][1]),
182 std::optional<CameraCalibration>
aux = std::nullopt;
207 std::shared_ptr<const std::vector<uint8_t>>
raw_data =
nullptr;
261 template <
typename T>
262 std::optional<T>
at(
int w,
int h)
const
278 const size_t offset =
sizeof(T) * ((
width * h) + w);
294 cv::Mat cv_mat()
const;
337 auto it =
images.find(source);
340 throw std::runtime_error(
"No image found for requested DataSource");
1262 return input_camera_time + std::chrono::duration_cast<std::chrono::system_clock::duration>(
offset_to_host());
1274 std::optional<PtpStatus>
ptp = std::nullopt;
1289 std::optional<PowerStatus>
power = std::nullopt;
1299 std::optional<TimeStatus>
time = std::nullopt;
1572 return std::to_string(
major) +
"." + std::to_string(
minor) +
"." + std::to_string(
patch);
1596 return *
this < other || *
this == other;
1604 return other < *
this;
1612 return other <= *
this;
DataSource
Identifies which camera or data source the image is from.
@ AUX_RECTIFIED_COMPRESSED
@ LEFT_RECTIFIED_COMPRESSED
@ AUX_CHROMA_RECTIFIED_RAW
@ RIGHT_RECTIFIED_COMPRESSED
@ LEFT_DISPARITY_COMPRESSED
std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > TimeT
std::array< float, 3 > rectified_translation() const
Get the translation vector in meters which translates points in the current CameraCalibration frame t...
std::array< std::array< float, 3 >, 3 > R
Rotation matrix which takes points in the unrectified camera frame and transform them in to the recti...
std::array< std::array< float, 3 >, 3 > K
Unrectified camera projection matrix stored in row-major ordering.
DistortionType
Distortion type.
DistortionType distortion_type
The type of the distortion model used for the unrectified camera.
std::vector< float > D
Coefficients for the distortion model.
std::array< std::array< float, 4 >, 3 > P
Rectified projection matrix which takes points in the origin camera coordinate frame and projects the...
A frame containing multiple images (indexed by DataSource).
StereoCalibration calibration
The scaled calibration for the entire camera.
float capture_gain
The gain that was used to capture the stereo images in this frame.
ColorImageEncoding aux_color_encoding
The encoding of the aux color image(s) in the frame.
void add_image(const Image &image)
Add an image to the frame, keyed by the image's DataSource.
const Image & get_image(const DataSource &source) const
Retrieve image by DataSource.
std::optional< ImageHistogram > stereo_histogram
Corresponding histogram from the main stereo pair.
TimeT ptp_frame_time
The MultiSense ptp timestamp associated with the frame.
std::chrono::microseconds capture_exposure_time
The exposure time which was used to capture this frame.
bool has_image(const DataSource &source) const
Check if we have an image for a given data source.
TimeT frame_time
The MultiSense timestamp associated with the frame.
int64_t frame_id
The unique monotonically increasing ID for each frame populated by the MultiSense.
std::map< DataSource, Image > images
The images associated with each source in the frame.
A object containing histogram data for a image.
uint32_t channels
The number of channels per pixel.
std::vector< uint32_t > data
The raw histogram counts whose size is equal to channels*bins.
uint32_t bins
The number of possible pixel bins.
Represents a single image plus metadata.
TimeT camera_timestamp
The timestamp associated with the image based on the camera's clock.
int width
Width of the image in pixels.
PixelFormat format
The format of the image data stored in the raw_data stored in the raw_data buffer.
TimeT ptp_timestamp
The timestamp associated with the image based using the camera's clock which is potentially PTP synch...
PixelFormat
Pixel formats.
CameraCalibration calibration
The scaled calibration associated with the image.
std::optional< T > at(int w, int h) const
Get a pixel at a certain width/height location in the image.
int height
Height of the image in pixels.
int64_t image_data_offset
An offset into the raw_data pointer where the image data starts.
size_t image_data_length
The length of the image data after the image_data_offset has been applied.
std::shared_ptr< const std::vector< uint8_t > > raw_data
A pointer to the raw image data sent from the camera.
DataSource source
The camera data source which this image corresponds to.
A collection of IMU samples from the camera.
std::vector< ImuSample > samples
A batched collection of IMU samples.
The range for each sensor along with the corresponding sampling resolution.
float resolution
The min resolution the sensor can return.
bool operator==(const ImuRange &rhs) const
Equality operator.
float range
The max value the sensor can return.
A sample rate, and what impact it has on bandwidth.
bool operator==(const ImuRate &rhs) const
Equality operator.
float sample_rate
The sample rate for the sensor in Hz.
float bandwith_cutoff
The bandwith cutoff for a given IMU mode in Hz.
A generic measurement for a 3-axis IMU.
float z
Measurement on the z-axis of the sensor.
float y
Measurement on the y-axis of the sensor.
float x
Measurement on the x-axis of the sensor.
A single IMU sample from the camera.
TimeT ptp_sample_time
The MultiSense ptp timestamp associated with the frame.
std::optional< Measurement > accelerometer
The acceleration in units of Gs.
TimeT sample_time
The MultiSense timestamp associated with the frame.
std::optional< Measurement > gyroscope
The rotational velocity in degrees-per-second.
std::optional< Measurement > magnetometer
The measured magnetic field in milligauss.
Auto-exposure specific configuration.
bool operator==(const AutoExposureConfig &rhs) const
Equality operator.
float target_intensity
The auto-exposure algorithm in digital imaging endeavors to achieve a specified target intensity,...
float max_gain
The auto exposure algorithm adjusts both exposure and gain.
AutoExposureRoiConfig roi
The auto exposure region-of-interest used to restrict the portion of the image which the auto exposur...
uint32_t decay
The desired auto-exposure decay rate.
std::chrono::microseconds max_exposure_time
The max exposure time auto exposure algorithm can set in microseconds Valid range is [0,...
float target_threshold
The fraction of pixels which must be equal or below the pixel value set by the target intensity pixel...
Auto-exposure Region-of-Interest (ROI) specific configuration.
uint16_t width
The width of the ROI in the full resolution image.
uint16_t height
The height of the ROI in the full resolution image.
uint16_t top_left_x_position
The x value of the top left corner of the ROI in the full resolution image.
uint16_t top_left_y_position
The y value of the top left corner of the ROI in the full resolution image.
bool operator==(const AutoExposureRoiConfig &rhs) const
Equality operator.
Auto white balance specific configuration.
uint32_t decay
The decay rate used for auto-white-balance Valid range [0, 20].
float threshold
The auto white balance threshold Valid range [0.0, 1.0].
bool operator==(const AutoWhiteBalanceConfig &rhs) const
Equality operator.
Image specific configuration for the Aux imager.
bool sharpening_enabled
Enable sharpening.
uint8_t sharpening_limit
The maximum difference in pixels that sharpening is is allowed to change between neighboring pixels.
bool operator==(const AuxConfig &rhs) const
Equality operator.
ImageConfig image_config
Image configuration for the Aux imager.
float sharpening_percentage
The percentage strength of the sharpening gain to apply to the aux image Valid range is [0,...
Image specific configuration.
bool auto_exposure_enabled
Enable or disable auto exposure.
std::optional< AutoWhiteBalanceConfig > auto_white_balance
The white balance parameters to use if auto white balance is enabled.
bool auto_white_balance_enabled
Enable or disable auto white balance.
bool operator==(const ImageConfig &rhs) const
Equality operator.
std::optional< ManualWhiteBalanceConfig > manual_white_balance
The white balance parameters to use if auto white balance is disabled.
std::optional< AutoExposureConfig > auto_exposure
The exposure config to use if auto exposure is enabled.
float gamma
Set the gamma correction for the image.
std::optional< ManualExposureConfig > manual_exposure
The exposure config to use if auto exposure is disabled.
Config for a specific IMU operating mode.
ImuRate rate
The specific IMU rate configuration specified in ImuInfo::Source table.
ImuRange range
The specific IMU range configuration specified in ImuInfo::Source.
bool operator==(const OperatingMode &rhs) const
Equality operator.
bool enabled
Enable the current source.
Config for the IMU sensor.
bool operator==(const ImuConfig &rhs) const
Equality operator.
std::optional< OperatingMode > accelerometer
Configuration for the onboard accelerometer.
std::optional< OperatingMode > gyroscope
Configuration for the onboard gyroscope.
std::optional< OperatingMode > magnetometer
Configuration for the onboard magnetometer.
uint32_t samples_per_frame
The number of IMU samples which should be included in a IMU frame.
Lighting config for lights driven by GPIO outputs from the MultiSense.
float intensity
Lighting brightness ranging from 0 to 100.0.
bool operator==(const ExternalConfig &rhs) const
Equality operator.
FlashMode
Different flash modes for the camera.
uint32_t pulses_per_exposure
The number of pulses of the light per single exposure.
std::chrono::microseconds startup_time
The time it takes for the light to reach full brightness.
FlashMode flash
Configure flash mode.
Lighting config for lights integrated into the MultiSense.
bool flash
Enable flashing of the light.
bool operator==(const InternalConfig &rhs) const
Equality operator.
float intensity
Lighting brightness ranging from 0 to 100.0.
Lighting configuration for the camera.
std::optional< InternalConfig > internal
The internal lighting config.
std::optional< ExternalConfig > external
The external lighting config.
bool operator==(const LightingConfig &rhs) const
Equality operator.
Manual exposure specific configuration.
std::chrono::microseconds exposure_time
The manual exposure time in microseconds Valid range is [0, 33000].
float gain
The desired electrical and digital gain used to brighten the image.
bool operator==(const ManualExposureConfig &rhs) const
Equality operator.
Manual white balance specific configuration.
float red
The manual red white-balance setting Valid range is [0.25, 4].
bool operator==(const ManualWhiteBalanceConfig &rhs) const
Equality operator.
float blue
The manual blue white-balance setting Valid range is [0.25, 4].
Config for transmitting packets from the MultiSense to the host.
bool operator==(const NetworkTransmissionConfig &rhs) const
Equality operator.
bool packet_delay_enabled
Add a small delay between the transmission of each packet to hopefully interact better with slower cl...
Stereo specific configuration.
bool operator==(const StereoConfig &rhs) const
Equality operator.
float postfilter_strength
This is used to filter low confidence stereo data before it is sent to the host.
Config for time-based controls.
bool operator==(const TimeConfig &rhs) const
Equality operator.
bool ptp_enabled
Enable PTP sync on the camera.
Complete configuration object for configuring the MultiSense.
uint32_t height
The operating height of the MultiSense in pixels.
std::optional< LightingConfig > lighting_config
The lighting configuration for the camera.
MaxDisparities disparities
The max number of pixels the MultiSense searches when computing the disparity output.
ImageConfig image_config
The image configuration to use for the main stereo pair.
float frames_per_second
The target framerate the MultiSense should operate at.
std::optional< NetworkTransmissionConfig > network_config
Config to control network transmission settings.
MaxDisparities
Predefined disparity pixel search windows.
std::optional< TimeConfig > time_config
Config for the MultiSense time-sync options.
std::optional< ImuConfig > imu_config
The imu configuration to use for the camera.
StereoConfig stereo_config
The stereo configuration to use.
bool operator==(const MultiSenseConfig &rhs) const
Equality operator.
std::optional< AuxConfig > aux_config
The image configuration to use for the aux camera if present.
uint32_t width
The operating width of the MultiSense in pixels.
Info for the PCBs contained in the unit.
uint32_t revision
The revision number of the PCB.
std::string name
The name of the PCB This value can store at most 32 characters.
The Device information associated with the MultiSense.
LightingType lighting_type
The type of lighting used in the MultiSense.
float nominal_relative_aperture
The nominal relative aperture for the primary camera modules in f-stop.
std::vector< PcbInfo > pcb_info
Information about each PCB.
std::string serial_number
The unique serial number of the MultiSense This value can store at most 32 characters.
float nominal_stereo_baseline
The nominal stereo baseline in meters.
LensType lens_type
The type of the primary imager.
uint32_t number_of_lights
The number of lights the MultiSense controls.
uint32_t imager_width
The native width of the primary imager.
std::string imager_name
The name of the imager used by the primary camera.
LensType
MultiSense lens types.
HardwareRevision hardware_revision
The hardware revision of the MultiSense.
std::string lens_name
The name of the lens used for the primary camera For stereo cameras this is the Left/Right stereo pai...
std::string camera_name
The name of the MultiSense variant.
float nominal_focal_length
The nominal focal length for the primary lens in meters.
HardwareRevision
MultiSense Hardware revisions.
uint32_t imager_height
The native height of the primary imager.
ImagerType
Different imager types.
ImagerType imager_type
The type of the imager.
std::string build_date
The date the MultiSense was manufactured This value can store at most 32 characters.
constexpr bool has_main_stereo_color() const
Determine if the MultiSense's main stereo pair supports color.
LightingType
MultiSense lighting types.
@ OUTPUT_TRIGGER
A GPIO line is used to trigger an external light.
@ PATTERN_PROJECTOR
A pattern projector.
@ INTERNAL
Lights driven internally.
@ PATTERN_PROJECTOR_OUTPUT_TRIGGER
A pattern projector with a GPIO line used to trigger a external light.
@ EXTERNAL
Drive lights via an external output.
constexpr bool has_aux_camera() const
Determine if the MultiSense has a Aux color camera.
Info about the available IMU configurations.
std::vector< ImuRate > rates
The available rates supported by this operating mode.
std::vector< ImuRange > ranges
The available ranges supported by this operating mode.
std::string name
The name of the IMU sensor.
std::string device
The name of the IMU chip.
Information about the IMU onboard the MultiSense.
std::optional< Source > magnetometer
Configuration specific to the magnetometer.
std::optional< Source > accelerometer
Configuration specific to the accelerometer.
std::optional< Source > gyroscope
Configuration specific to the gyroscope.
The network configuration for the MultiSense.
std::string gateway
The gateway of the camera (i.e.
std::string netmask
The netmask of the camera (i.e.
std::string ip_address
The ip address of the camera (i.e.
Version information for the MultiSense.
MultiSenseInfo::Version firmware_version
The version of the firmware running on the camera.
uint64_t hardware_version
ID for the version of hardware.
std::string firmware_build_date
The date the firmware running on the camera was built.
A valid operating mode for the MultiSense.
uint32_t height
The height of the output image in pixels.
std::vector< DataSource > supported_sources
Data sources supported at that mode.
uint32_t width
The width of the output image in pixels.
MultiSenseConfig::MaxDisparities disparities
Supported operating disparity.
Convenience wrapper for a version number See https://semver.org/.
uint32_t patch
Patch version number.
uint32_t major
Major version number.
bool operator>=(const Version &other) const
Convenience greater-than or equal to operator for comparing versions.
bool operator==(const Version &other) const
Convenience equality operator for comparing versions.
bool operator>(const Version &other) const
Convenience greater-than operator for comparing versions.
bool operator<=(const Version &other) const
Convenience less-than or equal to operator for comparing versions.
bool operator<(const Version &other) const
Convenience less-than operator for comparing versions.
uint32_t minor
Minor version number.
std::string to_string() const
Convert a Version info to string for convenience.
Static status info for the MultiSense.
std::optional< ImuInfo > imu
Supported operating modes for the IMU sensors (accelerometer, gyroscope, magnetometer).
SensorVersion version
Sensor Version info.
std::vector< SupportedOperatingMode > operating_modes
Supported operating modes.
DeviceInfo device
Device info.
NetworkInfo network
The network configuration of the MultiSense.
bool processing_pipeline_ok
True if the onboard processing pipeline is ok and currently processing images.
bool cameras_ok
True if the cameras are operating and currently streaming data.
size_t invalid_packets
The total number of invalid packets received on the client side.
size_t dropped_messages
The total number of dropped messages on the client side.
size_t received_messages
The total number of valid messages received from the client.
size_t unprocessed_packets
The total number of packets we received over the wire, but were unable to process due to buffer limit...
float input_current
The current input current in Amperes.
float fpga_power
The current power draw of the FPGA in Watts.
float input_voltage
The current input voltage in volts.
bool grandmaster_present
Status of the grandmaster clock.
std::chrono::nanoseconds path_delay
The estimate delay of the PTP synchronization messages from the grandmaster.
std::array< uint8_t, 8 > grandmaster_id
The id of the current grandmaster clock (8 bytes, 0xXXXXXX.XXXX.XXXXXX)
uint16_t steps_from_local_to_grandmaster
The number of network hops from the grandmaster to the camera's clock.
std::chrono::nanoseconds grandmaster_offset
Offset between the camera's PTP Hardware Clock and the grandmaster clock.
float cpu_temperature
Temperature of the processing subsystem (CPU cores of SoC) in Celsius.
float left_imager_temperature
Temperature of the left imager in Celsius.
float fpga_temperature
Temperature of the FPGA in Celsius.
float right_imager_temperature
Temperature of the right imager in Celsius.
std::chrono::nanoseconds client_host_time
The time of the host machine running the client when the status request was sent.
std::chrono::nanoseconds camera_time
The camera's system time when the status message request was received.
std::chrono::nanoseconds offset_to_host() const
Compute the time offset which can manually be added to all camera timestamps to change the camera tim...
TimeT apply_offset_to_host(const TimeT &input_camera_time) const
Apply the time offset to a camera timestamps to camera timestamp from the reference clock of the came...
std::chrono::nanoseconds network_delay
The estimated network delay between when the status request was sent, and when the status request was...
Consolidated status information which can be queried on demand from the MultiSense.
std::optional< PowerStatus > power
The current power status.
ClientNetworkStatus client_network
The current client network statistics.
std::optional< TemperatureStatus > temperature
The current temperature status.
bool system_ok
Summary of the current MultiSense state.
std::optional< TimeStatus > time
The current timing status information.
std::optional< PtpStatus > ptp
The current ptp status.
CameraStatus camera
The current camera status.
CameraCalibration right
Calibration information for the right camera.
std::optional< CameraCalibration > aux
Calibration information for the aux camera (optional 3rd center camera)
CameraCalibration left
Calibration information for the left camera.