mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-03 19:47:46 +08:00
Update sdk version to v2.3.1
This commit is contained in:
@@ -20,4 +20,4 @@
|
||||
#include <libobsensor/h/StreamProfile.h>
|
||||
#include <libobsensor/h/Version.h>
|
||||
#include <libobsensor/h/TypeHelper.h>
|
||||
|
||||
#include <libobsensor/h/RecordPlayback.h>
|
||||
|
||||
@@ -14,9 +14,8 @@
|
||||
#include <libobsensor/hpp/Filter.hpp>
|
||||
#include <libobsensor/hpp/Frame.hpp>
|
||||
#include <libobsensor/hpp/Pipeline.hpp>
|
||||
// #include <libobsensor/hpp/RecordPlayback.hpp>
|
||||
#include <libobsensor/hpp/RecordPlayback.hpp>
|
||||
#include <libobsensor/hpp/Sensor.hpp>
|
||||
#include <libobsensor/hpp/StreamProfile.hpp>
|
||||
#include <libobsensor/hpp/Version.hpp>
|
||||
#include <libobsensor/hpp/TypeHelper.hpp>
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ OB_EXPORT void ob_set_logger_to_console(ob_log_severity severity, ob_error **err
|
||||
|
||||
/**
|
||||
* @brief Set the extensions directory
|
||||
* @brief The extensions directory is used to search for dynamic libraries that provide additional functionality to the SDK, such as the Frame filters.
|
||||
* @brief The extensions directory is used to search for dynamic libraries that provide additional functionality to the SDK, such as the Frame filters.
|
||||
*
|
||||
* @attention Should be called before creating the context and pipeline, otherwise the default extensions directory (./extensions) will be used.
|
||||
*
|
||||
|
||||
@@ -388,7 +388,7 @@ OB_EXPORT const char *ob_device_info_get_firmware_version(const ob_device_info *
|
||||
*
|
||||
* @param[in] info Device Information
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
* @return const char* The connection type,currently supports:"USB", "USB1.0", "USB1.1", "USB2.0", "USB2.1", "USB3.0", "USB3.1", "USB3.2", "Ethernet"
|
||||
* @return const char* The connection type, currently supports: "USB", "USB1.0", "USB1.1", "USB2.0", "USB2.1", "USB3.0", "USB3.1", "USB3.2", "Ethernet"
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_info_get_connection_type(const ob_device_info *info, ob_error **error);
|
||||
|
||||
@@ -399,7 +399,7 @@ OB_EXPORT const char *ob_device_info_get_connection_type(const ob_device_info *i
|
||||
*
|
||||
* @param info Device Information
|
||||
* @param error Pointer to an error object that will be set if an error occurs.
|
||||
* @return const char* The IP address,such as "192.168.1.10"
|
||||
* @return const char* The IP address, such as "192.168.1.10"
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_info_get_ip_address(const ob_device_info *info, ob_error **error);
|
||||
|
||||
@@ -533,7 +533,7 @@ OB_EXPORT const char *ob_device_list_get_device_serial_number(const ob_device_li
|
||||
* @param[in] list Device list object
|
||||
* @param[in] index Device index
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
* @return const char* returns the device connection type,currently supports:"USB", "USB1.0", "USB1.1", "USB2.0", "USB2.1", "USB3.0", "USB3.1", "USB3.2",
|
||||
* @return const char* returns the device connection type, currently supports: "USB", "USB1.0", "USB1.1", "USB2.0", "USB2.1", "USB3.0", "USB3.1", "USB3.2",
|
||||
* "Ethernet"
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_list_get_device_connection_type(const ob_device_list *list, uint32_t index, ob_error **error);
|
||||
@@ -546,10 +546,22 @@ OB_EXPORT const char *ob_device_list_get_device_connection_type(const ob_device_
|
||||
* @param list Device list object
|
||||
* @param index Device index
|
||||
* @param error Pointer to an error object that will be set if an error occurs.
|
||||
* @return const char* returns the device ip address,such as "192.168.1.10"
|
||||
* @return const char* returns the device ip address, such as "192.168.1.10"
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_list_get_device_ip_address(const ob_device_list *list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get device local mac address
|
||||
*
|
||||
* @attention Only valid for network devices, otherwise it will return "0:0:0:0:0:0".
|
||||
*
|
||||
* @param list Device list object
|
||||
* @param index Device index
|
||||
* @param error Pointer to an error object that will be set if an error occurs.
|
||||
* @return const char* returns the device mac address
|
||||
*/
|
||||
OB_EXPORT const char *ob_device_list_get_device_local_mac(const ob_device_list *list, uint32_t index, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a device.
|
||||
*
|
||||
@@ -580,7 +592,7 @@ OB_EXPORT ob_device *ob_device_list_get_device_by_serial_number(const ob_device_
|
||||
* @brief On Linux platform, for usb device, the uid of the device is composed of bus-port-dev, for example 1-1.2-1. But the SDK will remove the dev number and
|
||||
* only keep the bus-port as the uid to create the device, for example 1-1.2, so that we can create a device connected to the specified USB port. Similarly,
|
||||
* users can also directly pass in bus-port as uid to create device.
|
||||
* @brief For GMSL device,the uid is GMSL port with “gmsl2-” prefix, for example gmsl2-1.
|
||||
* @brief For GMSL device, the uid is GMSL port with "gmsl2-" prefix, for example gmsl2-1.
|
||||
*
|
||||
* @attention If the device has already been acquired and created elsewhere, repeated acquisitions will return an error.
|
||||
*
|
||||
|
||||
@@ -68,7 +68,7 @@ OB_EXPORT ob_exception_type ob_error_get_exception_type(const ob_error *error);
|
||||
/**
|
||||
* @brief Delete the error object.
|
||||
*
|
||||
* @param[in] error The error object to delete.
|
||||
* @param[in] error The error object to delete, you should set the pointer to NULL after calling this function.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_error(ob_error *error);
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ OB_EXPORT void ob_delete_frame(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Copy the information of the source frame object to the destination frame object.
|
||||
* @brief Including the index,timestamp,system timestamp,global timestamp and metadata will be copied.
|
||||
* @brief Including the index, timestamp, system timestamp, global timestamp and metadata will be copied.
|
||||
*
|
||||
* @param[in] src_frame Source frame object to copy the information from.
|
||||
* @param[in] dst_frame Destination frame object to copy the information to.
|
||||
@@ -224,7 +224,7 @@ OB_EXPORT void ob_frame_set_system_timestamp_us(ob_frame *frame, uint64_t system
|
||||
|
||||
/**
|
||||
* @brief Get the global timestamp of the frame in microseconds.
|
||||
* @brief The global timestamp is the time point when the frame was was captured by the device, and has been converted to the host clock domain. The
|
||||
* @brief The global timestamp is the time point when the frame was captured by the device, and has been converted to the host clock domain. The
|
||||
* conversion process base on the frame timestamp and can eliminate the timer drift of the device
|
||||
*
|
||||
* @attention The global timestamp is disabled by default. If global timestamp is not enabled, the function will return 0. To enable it, call @ref
|
||||
@@ -603,6 +603,24 @@ OB_EXPORT ob_frame *ob_frameset_get_frame_by_index(const ob_frame *frameset, uin
|
||||
*/
|
||||
OB_EXPORT void ob_frameset_push_frame(ob_frame *frameset, const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get point cloud frame width
|
||||
*
|
||||
* @param[in] frame point cloud Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
* @return uint32_t return the point cloud frame width
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_point_cloud_frame_get_width(const ob_frame *frame, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get point cloud frame height
|
||||
*
|
||||
* @param[in] frame point cloud Frame object
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
* @return uint32_t return the point cloud frame height
|
||||
*/
|
||||
OB_EXPORT uint32_t ob_point_cloud_frame_get_height(const ob_frame *frame, ob_error **error);
|
||||
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
#define ob_frame_index ob_frame_get_index
|
||||
#define ob_frame_format ob_frame_get_format
|
||||
|
||||
@@ -62,7 +62,7 @@ OB_EXPORT ob_multi_device_sync_config ob_device_get_multi_device_sync_config(con
|
||||
*
|
||||
* @attention The frequency of the user call this function multiplied by the number of frames per trigger should be less than the frame rate of the stream. The
|
||||
* number of frames per trigger can be set by @ref framesPerTrigger.
|
||||
* @attention For some models,receive and execute the capture command will have a certain delay and performance consumption, so the frequency of calling this
|
||||
* @attention For some models, receive and execute the capture command will have a certain delay and performance consumption, so the frequency of calling this
|
||||
* function should not be too high, please refer to the product manual for the specific supported frequency.
|
||||
* @attention If the device is not in the @ref OB_MULTI_DEVICE_SYNC_MODE_HARDWARE_TRIGGERING mode, device will ignore the capture command.
|
||||
*
|
||||
|
||||
@@ -23,6 +23,8 @@ typedef struct ob_context_t ob_context;
|
||||
typedef struct ob_device_t ob_device;
|
||||
typedef struct ob_device_info_t ob_device_info;
|
||||
typedef struct ob_device_list_t ob_device_list;
|
||||
typedef struct ob_record_device_t ob_record_device;
|
||||
typedef struct ob_playback_device_t ob_playback_device;
|
||||
typedef struct ob_camera_param_list_t ob_camera_param_list;
|
||||
typedef struct ob_sensor_t ob_sensor;
|
||||
typedef struct ob_sensor_list_t ob_sensor_list;
|
||||
@@ -495,6 +497,15 @@ typedef enum {
|
||||
} OBAlignMode,
|
||||
ob_align_mode;
|
||||
|
||||
/**
|
||||
* @brief Camera performance mode
|
||||
*/
|
||||
typedef enum {
|
||||
ADAPTIVE_PERFORMANCE_MODE, /**< Camera adaptive mode */
|
||||
HIGH_PERFORMANCE_MODE, /**< High Performance Mode */
|
||||
} OBCameraPerformanceMode,
|
||||
ob_camera_performance_mode;
|
||||
|
||||
/**
|
||||
* @brief Rectangle
|
||||
*/
|
||||
@@ -714,14 +725,14 @@ typedef struct {
|
||||
double zpps; // zpps=z0/fx
|
||||
float baseline; // baseline length, for monocular camera,it means the distance of laser to the center of IR-CMOS
|
||||
double fx; // focus
|
||||
uint8_t bitSize; // disparity bit size(raw disp bit size,for example: MX6000 is 12, MX6600 is 14)
|
||||
float unit; // reference units:unit=10 denote 1cm; unit=1 denote 1mm; unit=0.5 denote 0.5mm; and so on
|
||||
uint8_t bitSize; // disparity bit size (raw disp bit size, for example: MX6000 is 12, MX6600 is 14)
|
||||
float unit; // reference units: unit=10 denote 1cm; unit=1 denote 1mm; unit=0.5 denote 0.5mm; and so on
|
||||
float minDisparity; // dual disparity coefficient
|
||||
uint8_t packMode; // data pack mode
|
||||
float dispOffset; // disparity offset,actual disp=chip disp + disp_offset
|
||||
int32_t invalidDisp; // invalid disparity,usually is 0,dual IR add a auxiliary value.
|
||||
int32_t dispIntPlace; // disp integer digits,default is 8,Gemini2 XL is 10
|
||||
uint8_t isDualCamera; // 0 monocular camera,1 dual camera
|
||||
float dispOffset; // disparity offset, actual disp=chip disp + disp_offset
|
||||
int32_t invalidDisp; // invalid disparity, usually is 0, dual IR add a auxiliary value.
|
||||
int32_t dispIntPlace; // disp integer digits, default is 8, Gemini2 XL is 10
|
||||
uint8_t isDualCamera; // 0 monocular camera, 1 dual camera
|
||||
} OBDisparityParam, ob_disparity_param;
|
||||
|
||||
/**
|
||||
@@ -826,7 +837,7 @@ typedef enum {
|
||||
/**
|
||||
* @brief Secondary synchronize mode
|
||||
* @brief Secondary device. Both process input trigger signal and output trigger signal to other devices.
|
||||
* @brief Different sensors in a single devices receive trigger signals respectively:ext trigger -> RGB && ext trigger -> IR/Depth/TOF
|
||||
* @brief Different sensors in a single devices receive trigger signals respectively: ext trigger -> RGB && ext trigger -> IR/Depth/TOF
|
||||
*
|
||||
* @attention With the current Gemini 2 device set to this mode, each Sensor receives the first external trigger signal
|
||||
* after the stream is turned on and starts timing self-triggering at the set frame rate until the stream is turned off
|
||||
@@ -860,7 +871,7 @@ typedef enum {
|
||||
* @brief Software trigger synchronize mode as secondary device
|
||||
* @brief The slave receives the external trigger signal (the external trigger signal comes from the soft trigger host) and outputs the trigger signal to
|
||||
* the external relay.
|
||||
* @brief Different sensors in a single machine receive trigger signals respectively:ext trigger -> RGB && ext trigger -> IR/Depth/TOF
|
||||
* @brief Different sensors in a single machine receive trigger signals respectively: ext trigger -> RGB && ext trigger -> IR/Depth/TOF
|
||||
*/
|
||||
OB_SYNC_MODE_SECONDARY_SOFT_TRIGGER = 0x07,
|
||||
|
||||
@@ -1295,14 +1306,14 @@ typedef struct {
|
||||
/**
|
||||
* @brief The delay time of the depth image capture after receiving the capture command or trigger signal in microseconds.
|
||||
*
|
||||
* @attention This parameter is only valid for some models, please refer to the product manual for details.
|
||||
* @attention This parameter is only valid for some models, please refer to the product manual for details.
|
||||
*/
|
||||
int depthDelayUs;
|
||||
|
||||
/**
|
||||
* @brief The delay time of the color image capture after receiving the capture command or trigger signal in microseconds.
|
||||
*
|
||||
* @attention This parameter is only valid for some models, please refer to the product manual for details.
|
||||
* @attention This parameter is only valid for some models, please refer to the product manual for details.
|
||||
*/
|
||||
int colorDelayUs;
|
||||
|
||||
@@ -1548,14 +1559,14 @@ typedef enum {
|
||||
|
||||
/**
|
||||
* @brief Power line frequency
|
||||
* @brief For anti-flickering, 0:Close, 1: 50Hz, 2: 60Hz, 3: Auto
|
||||
* @brief For anti-flickering, 0: Close, 1: 50Hz, 2: 60Hz, 3: Auto
|
||||
*/
|
||||
OB_FRAME_METADATA_TYPE_POWER_LINE_FREQUENCY = 15,
|
||||
|
||||
/**
|
||||
* @brief Low light compensation
|
||||
*
|
||||
* @attention The low light compensation is a feature inside the device,and can not manually control it.
|
||||
* @attention The low light compensation is a feature inside the device, and can not manually control it.
|
||||
*/
|
||||
OB_FRAME_METADATA_TYPE_LOW_LIGHT_COMPENSATION = 16,
|
||||
|
||||
@@ -1678,9 +1689,26 @@ typedef enum {
|
||||
*
|
||||
*/
|
||||
OB_UVC_BACKEND_TYPE_V4L2,
|
||||
|
||||
/**
|
||||
* @brief Use MSMF backend to access the UVC device
|
||||
*/
|
||||
OB_UVC_BACKEND_TYPE_MSMF,
|
||||
} ob_uvc_backend_type,
|
||||
OBUvcBackendType;
|
||||
|
||||
|
||||
/**
|
||||
* @brief The playback status of the media
|
||||
*/
|
||||
typedef enum {
|
||||
OB_PLAYBACK_UNKNOWN ,
|
||||
OB_PLAYBACK_PLAYING, /**< The media is playing */
|
||||
OB_PLAYBACK_PAUSED, /**< The media is paused */
|
||||
OB_PLAYBACK_STOPPED, /**< The media is stopped */
|
||||
OB_PLAYBACK_COUNT,
|
||||
} ob_playback_status, OBPlaybackStatus;
|
||||
|
||||
// For compatibility
|
||||
#define OB_FRAME_METADATA_TYPE_LASER_POWER_MODE OB_FRAME_METADATA_TYPE_LASER_POWER_LEVEL
|
||||
#define OB_FRAME_METADATA_TYPE_EMITTER_MODE OB_FRAME_METADATA_TYPE_LASER_STATUS
|
||||
@@ -1787,6 +1815,7 @@ typedef void(ob_frame_destroy_callback)(uint8_t *buffer, void *user_data);
|
||||
*/
|
||||
typedef void(ob_log_callback)(ob_log_severity severity, const char *message, void *user_data);
|
||||
|
||||
typedef void(*ob_playback_status_changed_callback)(ob_playback_status status, void *user_data);
|
||||
/**
|
||||
* @brief Check if the sensor_type is a video sensor
|
||||
*
|
||||
|
||||
@@ -306,7 +306,7 @@ typedef enum {
|
||||
OB_PROP_DEPTH_ROTATE_INT = 118,
|
||||
|
||||
/**
|
||||
* @brief Get hardware laser power actual level which real state of laser element. OB_PROP_LASER_POWER_LEVEL_CONTROL_INT99)will effect this command
|
||||
* @brief Get hardware laser power actual level which real state of laser element. OB_PROP_LASER_POWER_LEVEL_CONTROL_INT99 will effect this command
|
||||
* which it setting and changed the hardware laser energy level.
|
||||
*/
|
||||
OB_PROP_LASER_POWER_ACTUAL_LEVEL_INT = 119,
|
||||
@@ -501,6 +501,14 @@ typedef enum {
|
||||
* @brief hardware noise remove filter threshold ,range [0.0 - 1.0]
|
||||
*/
|
||||
OB_PROP_HW_NOISE_REMOVE_FILTER_THRESHOLD_FLOAT = 212,
|
||||
/**
|
||||
* @brief soft trigger auto capture enable,use in OB_MULTI_DEVICE_SYNC_MODE_SOFTWARE_TRIGGERING mode
|
||||
*/
|
||||
OB_DEVICE_AUTO_CAPTURE_ENABLE_BOOL = 216,
|
||||
/**
|
||||
* @brief soft trigger auto capture interval time,use in OB_MULTI_DEVICE_SYNC_MODE_SOFTWARE_TRIGGERING mode
|
||||
*/
|
||||
OB_DEVICE_AUTO_CAPTURE_INTERVAL_TIME_INT = 217,
|
||||
/**
|
||||
* @brief Baseline calibration parameters
|
||||
*/
|
||||
@@ -553,7 +561,7 @@ typedef enum {
|
||||
|
||||
/**
|
||||
* @brief Device network static ip config record
|
||||
* @brief Using for get last static ip config,witch is record in device flash when user set static ip config
|
||||
* @brief Using for get last static ip config, witch is record in device flash when user set static ip config
|
||||
*
|
||||
* @attention read only
|
||||
*/
|
||||
@@ -800,6 +808,11 @@ typedef enum {
|
||||
*/
|
||||
OB_PROP_NETWORK_BANDWIDTH_TYPE_INT = 3027,
|
||||
|
||||
/**
|
||||
* @brief Switch device performance mode, currently available in Adaptive Mode and High Performance Mode, such as G335LE.
|
||||
*/
|
||||
OB_PROP_DEVICE_PERFORMANCE_MODE_INT = 3028,
|
||||
|
||||
/**
|
||||
* @brief Calibration JSON file read from device (Femto Mega, read only)
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file RecordPlayback.hpp
|
||||
* @brief Record and playback device-related types, including interfaces to create recording and playback devices,
|
||||
record and playback streaming data, etc.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "Device.h"
|
||||
|
||||
/**
|
||||
* @brief Create a recording device for the specified device with a specified file path and compression enabled.
|
||||
*
|
||||
* @param[in] device The device to record.
|
||||
* @param[in] file_path The file path to record to.
|
||||
* @param[in] compression_enabled Whether to enable compression for the recording.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
* @return A pointer to the newly created recording device, or NULL if an error occurred.
|
||||
*/
|
||||
OB_EXPORT ob_record_device *ob_create_record_device(ob_device *device, const char *file_path, bool compression_enabled, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Delete a recording device.
|
||||
*
|
||||
* @param[in] recorder The recording device to delete.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_delete_record_device(ob_record_device *recorder, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Pause recording on the specified recording device.
|
||||
*
|
||||
* @param[in] recorder The recording device to pause.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_record_device_pause(ob_record_device *recorder, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Resume recording on the specified recording device.
|
||||
*
|
||||
* @param[in] recorder The recording device to resume.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_record_device_resume(ob_record_device *recorder, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Create a playback device for the specified file path.
|
||||
*
|
||||
* @param[in] file_path The file path to playback from.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
* @return A pointer to the newly created playback device, or NULL if an error occurred.
|
||||
*/
|
||||
OB_EXPORT ob_device *ob_create_playback_device(const char *file_path, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Pause playback on the specified playback device.
|
||||
*
|
||||
* @param[in] player The playback device to pause.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_playback_device_pause(ob_device *player, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Resume playback on the specified playback device.
|
||||
*
|
||||
* @param[in] player The playback device to resume.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_playback_device_resume(ob_device *player, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the playback to a specified time point of the played data.
|
||||
*
|
||||
* @param[in] player The playback device to set the position for.
|
||||
* @param[in] timestamp The position to set the playback to, in milliseconds.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_playback_device_seek(ob_device *player, const uint64_t timestamp, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set the playback to a specified time point of the played data.
|
||||
*
|
||||
* @param[in] player The playback device to set the position for.
|
||||
* @param[in] rate The playback rate to set.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_playback_device_set_playback_rate(ob_device *player, const float rate, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the current playback status of the played data.
|
||||
*
|
||||
* @param[in] player The playback device to get the status for.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
* @return The current playback status of the played data.
|
||||
*/
|
||||
OB_EXPORT ob_playback_status ob_playback_device_get_current_playback_status(ob_device *player, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Set a callback function to receive playback status updates.
|
||||
*
|
||||
* @param[in] player The playback device to set the callback for.
|
||||
* @param[in] callback The callback function to receive playback status updates.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*/
|
||||
OB_EXPORT void ob_playback_device_set_playback_status_changed_callback(ob_device *player, ob_playback_status_changed_callback callback, void *user_data,
|
||||
ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the current playback position of the played data.
|
||||
*
|
||||
* @param[in] player The playback device to get the position for.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
* @return The current playback position of the played data, in milliseconds.
|
||||
*/
|
||||
OB_EXPORT uint64_t ob_playback_device_get_position(ob_device *player, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Get the duration of the played data.
|
||||
*
|
||||
* @param[in] player The playback device to get the duration for.
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
* @return The duration of the played data, in milliseconds.
|
||||
*/
|
||||
OB_EXPORT uint64_t ob_playback_device_get_duration(ob_device *player, ob_error **error);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
@@ -19,8 +19,7 @@ extern "C" {
|
||||
*
|
||||
* @return bool Transform result
|
||||
*/
|
||||
OB_EXPORT bool ob_transformation_3d_to_3d(const OBPoint3f source_point3f, OBExtrinsic extrinsic, OBPoint3f *target_point3f, ob_error **error) ;
|
||||
|
||||
OB_EXPORT bool ob_transformation_3d_to_3d(const OBPoint3f source_point3f, OBExtrinsic extrinsic, OBPoint3f *target_point3f, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Transform a 2d pixel coordinate with an associated depth value of the source camera into a 3d point of the target coordinate system.
|
||||
@@ -35,9 +34,8 @@ OB_EXPORT bool ob_transformation_3d_to_3d(const OBPoint3f source_point3f, OBExtr
|
||||
*
|
||||
* @return bool Transform result
|
||||
*/
|
||||
OB_EXPORT bool ob_transformation_2d_to_3d(const OBPoint2f source_point2f, const float source_depth_pixel_value, const OBCameraIntrinsic source_intrinsic,
|
||||
OBExtrinsic extrinsic, OBPoint3f *target_point3f, ob_error **error);
|
||||
|
||||
OB_EXPORT bool ob_transformation_2d_to_3d(const OBPoint2f source_point2f, const float source_depth_pixel_value, const OBCameraIntrinsic source_intrinsic,
|
||||
OBExtrinsic extrinsic, OBPoint3f *target_point3f, ob_error **error);
|
||||
|
||||
/**
|
||||
* @brief Transform a 3d point of a source coordinate system into a 2d pixel coordinate of the target camera.
|
||||
@@ -69,46 +67,59 @@ OB_EXPORT bool ob_transformation_3d_to_2d(const OBPoint3f source_point3f, const
|
||||
*
|
||||
* @return bool Transform result
|
||||
*/
|
||||
OB_EXPORT bool ob_transformation_2d_to_2d(const OBPoint2f source_point2f, const float source_depth_pixel_value, const OBCameraIntrinsic source_intrinsic,
|
||||
const OBCameraDistortion source_distortion, const OBCameraIntrinsic target_intrinsic, const OBCameraDistortion target_distortion,
|
||||
OBExtrinsic extrinsic, OBPoint2f *target_point2f, ob_error **error);
|
||||
OB_EXPORT bool ob_transformation_2d_to_2d(const OBPoint2f source_point2f, const float source_depth_pixel_value, const OBCameraIntrinsic source_intrinsic,
|
||||
const OBCameraDistortion source_distortion, const OBCameraIntrinsic target_intrinsic,
|
||||
const OBCameraDistortion target_distortion, OBExtrinsic extrinsic, OBPoint2f *target_point2f, ob_error **error);
|
||||
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
OB_EXPORT ob_frame *transformation_depth_frame_to_color_camera(ob_device *device, ob_frame *depth_frame, uint32_t target_color_camera_width,
|
||||
uint32_t target_color_camera_height, ob_error **error);
|
||||
uint32_t target_color_camera_height, ob_error **error);
|
||||
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
OB_EXPORT bool transformation_init_xy_tables(const ob_calibration_param calibration_param, const ob_sensor_type sensor_type, float *data, uint32_t *data_size,
|
||||
ob_xy_tables *xy_tables, ob_error **error);
|
||||
ob_xy_tables *xy_tables, ob_error **error);
|
||||
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
OB_EXPORT void transformation_depth_to_pointcloud(ob_xy_tables *xy_tables, const void *depth_image_data, void *pointcloud_data, ob_error **error);
|
||||
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
OB_EXPORT void transformation_depth_to_rgbd_pointcloud(ob_xy_tables *xy_tables, const void *depth_image_data, const void *color_image_data, void *pointcloud_data,
|
||||
ob_error **error);
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
OB_EXPORT void transformation_depth_to_rgbd_pointcloud(ob_xy_tables *xy_tables, const void *depth_image_data, const void *color_image_data,
|
||||
void *pointcloud_data, ob_error **error);
|
||||
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
// Use the ob_transformation_3d_to_3d instead.
|
||||
OB_EXPORT bool ob_calibration_3d_to_3d(const ob_calibration_param calibration_param, const ob_point3f source_point3f, const ob_sensor_type source_sensor_type,
|
||||
const ob_sensor_type target_sensor_type, ob_point3f *target_point3f, ob_error **error);
|
||||
const ob_sensor_type target_sensor_type, ob_point3f *target_point3f, ob_error **error);
|
||||
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
// Use the ob_transformation_2d_to_3d instead.
|
||||
OB_EXPORT bool ob_calibration_2d_to_3d(const ob_calibration_param calibration_param, const ob_point2f source_point2f, const float source_depth_pixel_value,
|
||||
const ob_sensor_type source_sensor_type, const ob_sensor_type target_sensor_type, ob_point3f *target_point3f, ob_error **error);
|
||||
const ob_sensor_type source_sensor_type, const ob_sensor_type target_sensor_type, ob_point3f *target_point3f,
|
||||
ob_error **error);
|
||||
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
// Use the ob_transformation_3d_to_2d instead.
|
||||
OB_EXPORT bool ob_calibration_3d_to_2d(const ob_calibration_param calibration_param, const ob_point3f source_point3f, const ob_sensor_type source_sensor_type,
|
||||
const ob_sensor_type target_sensor_type, ob_point2f *target_point2f, ob_error **error);
|
||||
const ob_sensor_type target_sensor_type, ob_point2f *target_point2f, ob_error **error);
|
||||
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
// \deprecated This function is deprecated and will be removed in a future version.
|
||||
// Use the ob_transformation_2d_to_2d instead.
|
||||
OB_EXPORT bool ob_calibration_2d_to_2d(const ob_calibration_param calibration_param, const ob_point2f source_point2f, const float source_depth_pixel_value,
|
||||
const ob_sensor_type source_sensor_type, const ob_sensor_type target_sensor_type, ob_point2f *target_point2f, ob_error **error);
|
||||
|
||||
|
||||
const ob_sensor_type source_sensor_type, const ob_sensor_type target_sensor_type, ob_point2f *target_point2f,
|
||||
ob_error **error);
|
||||
/**
|
||||
* @brief save point cloud to ply file.
|
||||
*
|
||||
* @param[in] file_name Point cloud save path
|
||||
* @param[in] frame Point cloud frame
|
||||
* @param[in] save_binary Binary or textual,true: binary, false: textual
|
||||
* @param[in] use_mesh Save mesh or not, true: save as mesh, false: not save as mesh
|
||||
* @param[in] mesh_threshold Distance threshold for creating faces in point cloud,default value :50
|
||||
* @param[out] error Pointer to an error object that will be set if an error occurs.
|
||||
*
|
||||
* @return bool save point cloud result
|
||||
*/
|
||||
OB_EXPORT bool ob_save_pointcloud_to_ply(const char *file_name, ob_frame *frame, bool save_binary, bool use_mesh, float mesh_threshold, ob_error **error);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
* @brief Creates a network device with the specified IP address and port.
|
||||
*
|
||||
* @param[in] address The IP address, ipv4 only. such as "192.168.1.10"
|
||||
* @param[in] port The port number, currently only support 8090
|
||||
* @param[in] port The port number, currently only support 8090
|
||||
* @return std::shared_ptr<Device> The created device object.
|
||||
*/
|
||||
std::shared_ptr<Device> createNetDevice(const char *address, uint16_t port) const {
|
||||
@@ -210,7 +210,7 @@ public:
|
||||
|
||||
/**
|
||||
* @brief Set the extensions directory
|
||||
* @brief The extensions directory is used to search for dynamic libraries that provide additional functionality to the SDK, such as the Frame filters.
|
||||
* @brief The extensions directory is used to search for dynamic libraries that provide additional functionality to the SDK, such as the Frame filters.
|
||||
*
|
||||
* @attention Should be called before creating the context and pipeline, otherwise the default extensions directory (./extensions) will be used.
|
||||
*
|
||||
|
||||
@@ -491,7 +491,7 @@ public:
|
||||
* Please delete the object directly and obtain it again after the device is reconnected.
|
||||
* Support devices: Gemini2 L
|
||||
*
|
||||
* @param[in] delayMs Time unit:ms。delayMs == 0:No delay;delayMs > 0, Delay millisecond connect to host device after reboot
|
||||
* @param[in] delayMs Time unit: ms. delayMs == 0: No delay; delayMs > 0, Delay millisecond connect to host device after reboot
|
||||
*/
|
||||
void reboot(uint32_t delayMs) const {
|
||||
setIntProperty(OB_PROP_DEVICE_REBOOT_DELAY_INT, delayMs);
|
||||
@@ -564,7 +564,7 @@ public:
|
||||
*
|
||||
* @attention The frequency of the user call this function multiplied by the number of frames per trigger should be less than the frame rate of the stream.
|
||||
* The number of frames per trigger can be set by @ref framesPerTrigger.
|
||||
* @attention For some models,receive and execute the capture command will have a certain delay and performance consumption, so the frequency of calling
|
||||
* @attention For some models, receive and execute the capture command will have a certain delay and performance consumption, so the frequency of calling
|
||||
* this function should not be too high, please refer to the product manual for the specific supported frequency.
|
||||
* @attention If the device is not in the @ref OB_MULTI_DEVICE_SYNC_MODE_HARDWARE_TRIGGERING mode, device will ignore the capture command.
|
||||
*/
|
||||
@@ -919,7 +919,7 @@ public:
|
||||
/**
|
||||
* @brief Get the connection type of the device
|
||||
*
|
||||
* @return const char* the connection type of the device,currently supports:"USB", "USB1.0", "USB1.1", "USB2.0", "USB2.1", "USB3.0", "USB3.1",
|
||||
* @return const char* the connection type of the device, currently supports: "USB", "USB1.0", "USB1.1", "USB2.0", "USB2.1", "USB3.0", "USB3.1",
|
||||
* "USB3.2", "Ethernet"
|
||||
*/
|
||||
const char *getConnectionType() const {
|
||||
@@ -1141,7 +1141,7 @@ public:
|
||||
* @brief Get device connection type
|
||||
*
|
||||
* @param index device index
|
||||
* @return const char* returns connection type,currently supports:"USB", "USB1.0", "USB1.1", "USB2.0", "USB2.1", "USB3.0", "USB3.1", "USB3.2", "Ethernet"
|
||||
* @return const char* returns connection type, currently supports: "USB", "USB1.0", "USB1.1", "USB2.0", "USB2.1", "USB3.0", "USB3.1", "USB3.2", "Ethernet"
|
||||
*/
|
||||
const char *getConnectionType(uint32_t index) const {
|
||||
ob_error *error = nullptr;
|
||||
@@ -1165,6 +1165,21 @@ public:
|
||||
return ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the local mac address of the device at the specified index
|
||||
*
|
||||
* @attention Only valid for network devices, otherwise it will return "0:0:0:0:0:0".
|
||||
*
|
||||
* @param index the index of the device
|
||||
* @return const char* the local mac address of the device
|
||||
*/
|
||||
const char *getLocalMacAddress(uint32_t index) const {
|
||||
ob_error *error = nullptr;
|
||||
auto mac = ob_device_list_get_device_local_mac(impl_, index, &error);
|
||||
Error::handle(&error);
|
||||
return mac;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the device object at the specified index
|
||||
*
|
||||
@@ -1200,7 +1215,7 @@ public:
|
||||
* @brief On Linux platform, for usb device, the uid of the device is composed of bus-port-dev, for example 1-1.2-1. But the SDK will remove the dev number
|
||||
* and only keep the bus-port as the uid to create the device, for example 1-1.2, so that we can create a device connected to the specified USB port.
|
||||
* Similarly, users can also directly pass in bus-port as uid to create device.
|
||||
* @brief For GMSL device,the uid is GMSL port with “gmsl2-” prefix, for example gmsl2-1.
|
||||
* @brief For GMSL device, the uid is GMSL port with "gmsl2-" prefix, for example gmsl2-1.
|
||||
*
|
||||
* @attention If the device has been acquired and created elsewhere, repeated acquisition will throw an exception
|
||||
*
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <functional>
|
||||
|
||||
/**
|
||||
* Frame classis inheritance hierarchy:
|
||||
* Frame classis inheritance hierarchy:
|
||||
* Frame
|
||||
* |
|
||||
* +-----------+----------+----------+-----------+
|
||||
@@ -181,7 +181,7 @@ public:
|
||||
|
||||
/**
|
||||
* @brief Get the global timestamp of the frame in microseconds.
|
||||
* @brief The global timestamp is the time point when the frame was was captured by the device, and has been converted to the host clock domain. The
|
||||
* @brief The global timestamp is the time point when the frame was captured by the device, and has been converted to the host clock domain. The
|
||||
* conversion process base on the device timestamp and can eliminate the timer drift of the device
|
||||
*
|
||||
* @attention The global timestamp disable by default. If global timestamp is not enabled, the function will return 0. To enable the global timestamp,
|
||||
@@ -593,6 +593,33 @@ public:
|
||||
return scale;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the width of the frame.
|
||||
*
|
||||
* @return uint32_t The width of the frame.
|
||||
*/
|
||||
uint32_t getWidth() const {
|
||||
ob_error *error = nullptr;
|
||||
// TODO
|
||||
auto width = ob_point_cloud_frame_get_width(impl_, &error);
|
||||
Error::handle(&error);
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the height of the frame.
|
||||
*
|
||||
* @return uint32_t The height of the frame.
|
||||
*/
|
||||
uint32_t getHeight() const {
|
||||
ob_error *error = nullptr;
|
||||
auto height = ob_point_cloud_frame_get_height(impl_, &error);
|
||||
Error::handle(&error);
|
||||
|
||||
return height;
|
||||
}
|
||||
|
||||
public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
#define getPositionValueScale getCoordinateValueScale
|
||||
@@ -957,7 +984,7 @@ private:
|
||||
|
||||
static void BufferDestroy(uint8_t *buffer, void *context) {
|
||||
auto *ctx = static_cast<BufferDestroyContext *>(context);
|
||||
if (ctx->callback) {
|
||||
if(ctx->callback) {
|
||||
ctx->callback(buffer);
|
||||
}
|
||||
delete ctx;
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
// Copyright (c) Orbbec Inc. All Rights Reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file RecordPlayback.hpp
|
||||
* @brief Record and playback device-related types, including interfaces to create recording and playback devices,
|
||||
record and playback streaming data, etc.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Types.hpp"
|
||||
#include "Error.hpp"
|
||||
#include "libobsensor/h/RecordPlayback.h"
|
||||
#include "libobsensor/hpp/Device.hpp"
|
||||
|
||||
namespace ob {
|
||||
|
||||
typedef std::function<void(OBPlaybackStatus status)> PlaybackStatusChangeCallback;
|
||||
|
||||
class RecordDevice {
|
||||
private:
|
||||
ob_record_device_t *impl_;
|
||||
|
||||
public:
|
||||
explicit RecordDevice(std::shared_ptr<Device> device, const std::string &file, bool compressionEnabled = true) {
|
||||
ob_error *error = nullptr;
|
||||
impl_ = ob_create_record_device(device->getImpl(), file.c_str(), compressionEnabled, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
virtual ~RecordDevice() noexcept {
|
||||
ob_error *error = nullptr;
|
||||
ob_delete_record_device(impl_, &error);
|
||||
Error::handle(&error, false);
|
||||
}
|
||||
|
||||
RecordDevice(RecordDevice &&other) {
|
||||
if(this != &other) {
|
||||
impl_ = other.impl_;
|
||||
other.impl_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
RecordDevice &operator=(RecordDevice &&other) {
|
||||
if(this != &other) {
|
||||
impl_ = other.impl_;
|
||||
other.impl_ = nullptr;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
RecordDevice(const RecordDevice &) = delete;
|
||||
RecordDevice &operator=(const RecordDevice &) = delete;
|
||||
|
||||
public:
|
||||
void pause() {
|
||||
ob_error *error = nullptr;
|
||||
ob_record_device_pause(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
void resume() {
|
||||
ob_error *error = nullptr;
|
||||
ob_record_device_resume(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
};
|
||||
|
||||
class PlaybackDevice : public Device {
|
||||
public:
|
||||
explicit PlaybackDevice(const std::string &file) : Device(nullptr) {
|
||||
ob_error *error = nullptr;
|
||||
impl_ = ob_create_playback_device(file.c_str(), &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
virtual ~PlaybackDevice() noexcept = default;
|
||||
|
||||
PlaybackDevice(PlaybackDevice &&other) : Device(std::move(other)) {}
|
||||
|
||||
PlaybackDevice &operator=(PlaybackDevice &&other) {
|
||||
Device::operator=(std::move(other));
|
||||
return *this;
|
||||
}
|
||||
|
||||
PlaybackDevice(const PlaybackDevice &) = delete;
|
||||
PlaybackDevice &operator=(const PlaybackDevice &) = delete;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Pause the streaming data from the playback device.
|
||||
*/
|
||||
void pause() {
|
||||
ob_error *error = nullptr;
|
||||
ob_playback_device_pause(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Resume the streaming data from the playback device.
|
||||
*/
|
||||
void resume() {
|
||||
ob_error *error = nullptr;
|
||||
ob_playback_device_resume(impl_, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Seek to a specific timestamp when playing back a recording.
|
||||
* @param[in] timestamp The timestamp to seek to, in milliseconds.
|
||||
*/
|
||||
void seek(const int64_t timestamp) {
|
||||
ob_error *error = nullptr;
|
||||
ob_playback_device_seek(impl_, timestamp, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the playback rate of the playback device.
|
||||
* @param[in] rate The playback rate to set.
|
||||
*/
|
||||
void setPlaybackRate(const float rate) {
|
||||
ob_error *error = nullptr;
|
||||
ob_playback_device_set_playback_rate(impl_, rate, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set a callback function to be called when the playback status changes.
|
||||
* @param[in] callback The callback function to set.
|
||||
*/
|
||||
void setPlaybackStatusChangeCallback(PlaybackStatusChangeCallback callback) {
|
||||
callback_ = callback;
|
||||
ob_error *error = nullptr;
|
||||
ob_playback_device_set_playback_status_changed_callback(impl_, &PlaybackDevice::playbackStatusCallback, this, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the current playback status of the playback device.
|
||||
* @return The current playback status.
|
||||
*/
|
||||
OBPlaybackStatus getPlaybackStatus() const {
|
||||
ob_error *error = nullptr;
|
||||
OBPlaybackStatus status = ob_playback_device_get_current_playback_status(impl_, &error);
|
||||
Error::handle(&error);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the current position of the playback device.
|
||||
* @return The current position of the playback device, in milliseconds.
|
||||
*/
|
||||
uint64_t getPosition() const {
|
||||
ob_error *error = nullptr;
|
||||
uint64_t position = ob_playback_device_get_position(impl_, &error);
|
||||
Error::handle(&error);
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the duration of the playback device.
|
||||
* @return The duration of the playback device, in milliseconds.
|
||||
*/
|
||||
uint64_t getDuration() const {
|
||||
ob_error *error = nullptr;
|
||||
uint64_t duration = ob_playback_device_get_duration(impl_, &error);
|
||||
Error::handle(&error);
|
||||
|
||||
return duration;
|
||||
}
|
||||
|
||||
private:
|
||||
static void playbackStatusCallback(OBPlaybackStatus status, void *userData) {
|
||||
auto *playbackDevice = static_cast<PlaybackDevice *>(userData);
|
||||
if(playbackDevice && playbackDevice->callback_) {
|
||||
playbackDevice->callback_(status);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
PlaybackStatusChangeCallback callback_;
|
||||
};
|
||||
} // namespace ob
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
* OB_STREAM_VIDEO,
|
||||
* OB_STREAM_DEPTH,
|
||||
* OB_STREAM_COLOR,
|
||||
* OB_STREAM_IR,
|
||||
* OB_STREAM_IR,
|
||||
* OB_STREAM_IR_LEFT,
|
||||
* OB_STREAM_IR_RIGHT,
|
||||
*
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
namespace ob {
|
||||
class Device;
|
||||
|
||||
class CoordinateTransformHelper {
|
||||
class CoordinateTransformHelper {
|
||||
public:
|
||||
/**
|
||||
* @brief Transform a 3d point of a source coordinate system into a 3d point of the target coordinate system.
|
||||
@@ -29,8 +29,8 @@ public:
|
||||
* @return bool Transform result
|
||||
*/
|
||||
static bool transformation3dto3d(const OBPoint3f source_point3f, OBExtrinsic extrinsic, OBPoint3f *target_point3f) {
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_transformation_3d_to_3d(source_point3f, extrinsic, target_point3f, &error);
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_transformation_3d_to_3d(source_point3f, extrinsic, target_point3f, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
@@ -48,8 +48,8 @@ public:
|
||||
*/
|
||||
static bool transformation2dto3d(const OBPoint2f source_point2f, const float source_depth_pixel_value, const OBCameraIntrinsic source_intrinsic,
|
||||
OBExtrinsic extrinsic, OBPoint3f *target_point3f) {
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_transformation_2d_to_3d(source_point2f, source_depth_pixel_value, source_intrinsic, extrinsic, target_point3f, &error);
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_transformation_2d_to_3d(source_point2f, source_depth_pixel_value, source_intrinsic, extrinsic, target_point3f, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
@@ -66,9 +66,9 @@ public:
|
||||
* @return bool Transform result
|
||||
*/
|
||||
static bool transformation3dto2d(const OBPoint3f source_point3f, const OBCameraIntrinsic target_intrinsic, const OBCameraDistortion target_distortion,
|
||||
OBExtrinsic extrinsic, OBPoint2f *target_point2f) {
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_transformation_3d_to_2d(source_point3f, target_intrinsic, target_distortion, extrinsic, target_point2f, &error);
|
||||
OBExtrinsic extrinsic, OBPoint2f *target_point2f) {
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_transformation_3d_to_2d(source_point3f, target_intrinsic, target_distortion, extrinsic, target_point2f, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
static bool transformation2dto2d(const OBPoint2f source_point2f, const float source_depth_pixel_value, const OBCameraIntrinsic source_intrinsic,
|
||||
const OBCameraDistortion source_distortion, const OBCameraIntrinsic target_intrinsic,
|
||||
const OBCameraDistortion target_distortion, OBExtrinsic extrinsic, OBPoint2f *target_point2f) {
|
||||
ob_error *error = NULL;
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_transformation_2d_to_2d(source_point2f, source_depth_pixel_value, source_intrinsic, source_distortion, target_intrinsic,
|
||||
target_distortion, extrinsic, target_point2f, &error);
|
||||
Error::handle(&error);
|
||||
@@ -101,8 +101,8 @@ public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
static bool calibration3dTo3d(const OBCalibrationParam calibrationParam, const OBPoint3f sourcePoint3f, const OBSensorType sourceSensorType,
|
||||
const OBSensorType targetSensorType, OBPoint3f *targetPoint3f) {
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_calibration_3d_to_3d(calibrationParam, sourcePoint3f, sourceSensorType, targetSensorType, targetPoint3f, &error);
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_calibration_3d_to_3d(calibrationParam, sourcePoint3f, sourceSensorType, targetSensorType, targetPoint3f, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
@@ -110,15 +110,16 @@ public:
|
||||
static bool calibration2dTo3d(const OBCalibrationParam calibrationParam, const OBPoint2f sourcePoint2f, const float sourceDepthPixelValue,
|
||||
const OBSensorType sourceSensorType, const OBSensorType targetSensorType, OBPoint3f *targetPoint3f) {
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_calibration_2d_to_3d(calibrationParam, sourcePoint2f, sourceDepthPixelValue, sourceSensorType, targetSensorType, targetPoint3f, &error);
|
||||
bool result =
|
||||
ob_calibration_2d_to_3d(calibrationParam, sourcePoint2f, sourceDepthPixelValue, sourceSensorType, targetSensorType, targetPoint3f, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool calibration3dTo2d(const OBCalibrationParam calibrationParam, const OBPoint3f sourcePoint3f, const OBSensorType sourceSensorType,
|
||||
const OBSensorType targetSensorType, OBPoint2f *targetPoint2f) {
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_calibration_3d_to_2d(calibrationParam, sourcePoint3f, sourceSensorType, targetSensorType, targetPoint2f, &error);
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_calibration_3d_to_2d(calibrationParam, sourcePoint3f, sourceSensorType, targetSensorType, targetPoint2f, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
@@ -126,7 +127,8 @@ public:
|
||||
static bool calibration2dTo2d(const OBCalibrationParam calibrationParam, const OBPoint2f sourcePoint2f, const float sourceDepthPixelValue,
|
||||
const OBSensorType sourceSensorType, const OBSensorType targetSensorType, OBPoint2f *targetPoint2f) {
|
||||
ob_error *error = NULL;
|
||||
bool result = ob_calibration_2d_to_2d(calibrationParam, sourcePoint2f, sourceDepthPixelValue, sourceSensorType, targetSensorType, targetPoint2f, &error);
|
||||
bool result =
|
||||
ob_calibration_2d_to_2d(calibrationParam, sourcePoint2f, sourceDepthPixelValue, sourceSensorType, targetSensorType, targetPoint2f, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
@@ -138,15 +140,15 @@ public:
|
||||
// unsafe operation, need to cast const to non-const
|
||||
auto unConstImpl = const_cast<ob_frame *>(depthFrame->getImpl());
|
||||
|
||||
auto result = transformation_depth_frame_to_color_camera(device->getImpl() , unConstImpl, targetColorCameraWidth, targetColorCameraHeight, &error);
|
||||
auto result = transformation_depth_frame_to_color_camera(device->getImpl(), unConstImpl, targetColorCameraWidth, targetColorCameraHeight, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<ob::Frame>(result);
|
||||
}
|
||||
|
||||
static bool transformationInitXYTables(const OBCalibrationParam calibrationParam, const OBSensorType sensorType, float *data, uint32_t *dataSize,
|
||||
OBXYTables *xyTables) {
|
||||
ob_error *error = NULL;
|
||||
bool result = transformation_init_xy_tables(calibrationParam, sensorType, data, dataSize, xyTables, &error);
|
||||
ob_error *error = NULL;
|
||||
bool result = transformation_init_xy_tables(calibrationParam, sensorType, data, dataSize, xyTables, &error);
|
||||
Error::handle(&error);
|
||||
return result;
|
||||
}
|
||||
@@ -157,11 +159,32 @@ public:
|
||||
Error::handle(&error, false);
|
||||
}
|
||||
|
||||
static void transformationDepthToRGBDPointCloud(OBXYTables *xyTables, const void *depthImageData, const void *colorImageData, void *pointCloudData){
|
||||
static void transformationDepthToRGBDPointCloud(OBXYTables *xyTables, const void *depthImageData, const void *colorImageData, void *pointCloudData) {
|
||||
ob_error *error = NULL;
|
||||
transformation_depth_to_rgbd_pointcloud(xyTables, depthImageData, colorImageData, pointCloudData, &error);
|
||||
Error::handle(&error, false);
|
||||
}
|
||||
};
|
||||
} // namespace ob
|
||||
|
||||
class PointCloudHelper {
|
||||
public:
|
||||
/**
|
||||
* @brief save point cloud to ply file.
|
||||
*
|
||||
* @param[in] fileName Point cloud save path
|
||||
* @param[in] frame Point cloud frame
|
||||
* @param[in] saveBinary Binary or textual,true: binary, false: textual
|
||||
* @param[in] useMesh Save mesh or not, true: save as mesh, false: not save as mesh
|
||||
* @param[in] meshThreshold Distance threshold for creating faces in point cloud,default value :50
|
||||
*
|
||||
* @return bool save point cloud result
|
||||
*/
|
||||
static bool savePointcloudToPly(const char *fileName, std::shared_ptr<ob::Frame> frame, bool saveBinary, bool useMesh, float meshThreshold) {
|
||||
ob_error *error = NULL;
|
||||
auto unConstImpl = const_cast<ob_frame *>(frame->getImpl());
|
||||
bool result = ob_save_pointcloud_to_ply(fileName, unConstImpl, saveBinary, useMesh, meshThreshold, &error);
|
||||
Error::handle(&error, false);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
} // namespace ob
|
||||
|
||||
Reference in New Issue
Block a user