Update sdk version to v2.4.1

This commit is contained in:
jj
2025-05-12 10:15:48 +08:00
parent 10aebfd896
commit b2ef7d2d07
33 changed files with 522 additions and 109 deletions
@@ -127,7 +127,7 @@ public:
/**
* @brief Activates device clock synchronization to synchronize the clock of the host and all created devices (if supported).
*
* @param repeatInterval The interval for auto-repeated synchronization, in milliseconds. If the value is 0, synchronization is performed only once.
* @param repeatIntervalMsec The interval for auto-repeated synchronization, in milliseconds. If the value is 0, synchronization is performed only once.
*/
void enableDeviceClockSync(uint64_t repeatIntervalMsec) const {
ob_error *error = nullptr;
@@ -146,12 +146,12 @@ public:
}
/**
* @brief For linux, there are two ways to enable the UVC backend: libuvc and libusb. This function is used to set the backend type.
* @brief For linux, there are two ways to enable the UVC backend: libuvc and v4l2. This function is used to set the backend type.
* @brief It is effective when the new device is created.
*
* @attention This interface is only available for Linux.
*
* @param[in] backend_type The backend type to be used.
* @param[in] type The backend type to be used.
*/
void setUvcBackendType(OBUvcBackendType type) const {
ob_error *error = nullptr;
@@ -202,7 +202,7 @@ public:
* @param callback The callback function.
*/
static void setLoggerToCallback(OBLogSeverity severity, LogCallback callback) {
ob_error *error = nullptr;
ob_error *error = nullptr;
Context::getLogCallback() = callback;
ob_set_logger_to_callback(severity, &Context::logCallback, &Context::getLogCallback(), &error);
Error::handle(&error);
@@ -240,7 +240,7 @@ private:
}
// Lazy initialization of the logcallback_. The purpose is to initialize logcallback_ in .hpp
static LogCallback& getLogCallback() {
static LogCallback &getLogCallback() {
static LogCallback logCallback_ = nullptr;
return logCallback_;
}
@@ -249,4 +249,3 @@ private:
#define enableMultiDeviceSync enableDeviceClockSync
};
} // namespace ob
@@ -292,6 +292,30 @@ public:
Error::handle(&error);
}
/**
* @brief Set the customer data type of a device property
*
* @param data The data to set
* @param dataSize The size of the data to set,the maximum length cannot exceed 65532 bytes.
*/
void writeCustomerData(const void *data, uint32_t dataSize) {
ob_error *error = nullptr;
ob_device_write_customer_data(impl_, data, dataSize, &error);
Error::handle(&error);
}
/**
* @brief Get the customer data type of a device property
*
* @param data The property data obtained
* @param dataSize The size of the data obtained
*/
void readCustomerData(void *data, uint32_t *dataSize) {
ob_error *error = nullptr;
ob_device_read_customer_data(impl_, data, dataSize, &error);
Error::handle(&error);
}
/**
* @brief Get the number of properties supported by the device
*
@@ -755,7 +779,7 @@ public:
* @param[in] sendData The data to be sent to the device.
* @param[in] sendDataSize The size of the data to be sent to the device.
* @param[out] receiveData The data received from the device.
* @param[in out] receiveDataSize The requeseted size of the data received from the device, and the actual size of the data received from the device.
* @param[in,out] receiveDataSize The requeseted size of the data received from the device, and the actual size of the data received from the device.
*/
void sendAndReceiveData(const uint8_t *sendData, uint32_t sendDataSize, uint8_t *receiveData, uint32_t *receiveDataSize) const {
ob_error *error = nullptr;
@@ -1394,9 +1418,9 @@ public:
}
/**
* @brief Get the number of device presets in the list
* @brief Get the number of camera parameters in the list.
*
* @return uint32_t the number of device presets in the list
* @return uint32_t the number of camera parameters in the list.
*/
uint32_t getCount() {
ob_error *error = nullptr;
@@ -22,10 +22,12 @@ private:
*
* @attention This constructor should not be called directly, use the handle() function instead.
*
* @param error
* @param error The ob_error object
*/
explicit Error(ob_error *error) : impl_(error) {};
Error& operator=(const Error&) = default;
public:
/**
* @brief A static function to handle the ob_error and throw an exception if needed.
@@ -311,7 +311,7 @@ public:
* @brief Some private filters require an activation key to be activated, its depends on the vendor of the filter.
*
* @param name The name of the filter.
* @param activation_key The activation key of the filter.
* @param activationKey The activation key of the filter.
*/
static std::shared_ptr<Filter> createPrivateFilter(const std::string &name, const std::string &activationKey) {
ob_error *error = nullptr;
@@ -352,7 +352,7 @@ public:
/**
* @brief Set the output pointcloud frame format.
*
* @param type The point cloud frame format: OB_FORMAT_POINT or OB_FORMAT_RGB_POINT
* @param format The point cloud frame format: OB_FORMAT_POINT or OB_FORMAT_RGB_POINT
*/
void setCreatePointFormat(OBFormat format) {
setConfigValue("pointFormat", static_cast<double>(format));
@@ -534,7 +534,7 @@ public:
/**
* @brief Set the sequenceId filter params.
*
* @param sequence id to pass the filter.
* @param sequence_id id to pass the filter.
*/
void selectSequenceId(int sequence_id) {
setConfigValue("sequenceid", static_cast<double>(sequence_id));
@@ -580,7 +580,7 @@ public:
/**
* @brief Set the decimation filter scale value.
*
* @param type The decimation filter scale value.
* @param value The decimation filter scale value.
*/
void setScaleValue(uint8_t value) {
setConfigValue("decimate", static_cast<double>(value));
@@ -796,7 +796,6 @@ public:
/**
* @brief Set the HoleFillingFilter mode.
*
* @param[in] filter A holefilling_filter object.
* @param mode OBHoleFillingMode, OB_HOLE_FILL_TOP,OB_HOLE_FILL_NEAREST or OB_HOLE_FILL_FAREST.
*/
void setFilterMode(OBHoleFillingMode mode) {
@@ -830,7 +829,7 @@ public:
/**
* @brief Set the noise removal filter params.
*
* @param[in] params ob_noise_removal_filter_params.
* @param[in] filterParams ob_noise_removal_filter_params.
*/
void setFilterParams(OBNoiseRemovalFilterParams filterParams) {
setConfigValue("max_size", static_cast<double>(filterParams.max_size));
@@ -929,11 +929,11 @@ public:
* @attention The buffer is owned by the caller, and will not be destroyed by the frame object. The user should ensure that the buffer is valid and not
* modified.
*
* @param[in] frame_type Frame object type.
* @param[in] frameType Frame object type.
* @param[in] format Frame object format.
* @param[in] buffer Frame object buffer.
* @param[in] buffer_size Frame object buffer size.
* @param[in] destroyCallback Destroy callback, will be called when the frame object is destroyed.
* @param[in] bufferSize Frame object buffer size.
*
* @return std::shared_ptr<Frame> The created frame object.
*/
@@ -95,7 +95,7 @@ public:
* If no parameters are specified, the stream will be enabled with default resolution settings.
* Users who wish to set custom resolutions should refer to the product manual, as available resolutions vary by camera model.
*
* @param type The video stream type.
* @param streamType The video stream type.
* @param width The video stream width (default is OB_WIDTH_ANY, which selects the default resolution).
* @param height The video stream height (default is OB_HEIGHT_ANY, which selects the default resolution).
* @param fps The video stream frame rate (default is OB_FPS_ANY, which selects the default frame rate).
@@ -182,7 +182,7 @@ public:
* @brief Disable a sensor stream to be used in the pipeline.
* @brief Will convert sensor type to stream type automatically.
*
* @param sensorType
* @param sensorType The sensor configuration to be disabled
*/
void disableStream(OBSensorType sensorType) const {
auto streamType = ob::TypeHelper::convertSensorTypeToStreamType(sensorType);
@@ -346,7 +346,7 @@ public:
/**
* @brief Wait for frameset
*
* @param timeout_ms The waiting timeout in milliseconds
* @param timeoutMs The waiting timeout in milliseconds
* @return std::shared_ptr<FrameSet> The waiting frameset data
*/
std::shared_ptr<FrameSet> waitForFrameset(uint32_t timeoutMs = 1000) const {
@@ -51,9 +51,9 @@ public:
}
/**
* @brief Get the format of the stream
* @brief Get the format of the stream.
*
* @return OBFormat return the format of the stream
* @return OBFormat return the format of the stream.
*/
OBFormat getFormat() const {
ob_error *error = nullptr;
@@ -63,9 +63,9 @@ public:
}
/**
* @brief Get the type of stream
* @brief Get the type of stream.
*
* @return OBStreamType return the type of the stream
* @return OBStreamType return the type of the stream.
*/
OBStreamType getType() const {
ob_error *error = nullptr;
@@ -75,7 +75,7 @@ public:
}
/**
* @brief Get the extrinsic parameters from current stream profile to the given target stream profile
* @brief Get the extrinsic parameters from current stream profile to the given target stream profile.
*
* @return OBExtrinsic Return the extrinsic parameters.
*/
@@ -87,17 +87,41 @@ public:
}
/**
* @brief Check if frame object is compatible with the given type
* @brief Set the extrinsic parameters from current stream profile to the given target stream profile.
*
* @tparam target Target stream profile.
* @tparam extrinsic The extrinsic.
*/
void bindExtrinsicTo(std::shared_ptr<StreamProfile> target, const OBExtrinsic &extrinsic) {
ob_error *error = nullptr;
ob_stream_profile_set_extrinsic_to(const_cast<ob_stream_profile_t *>(impl_), const_cast<const ob_stream_profile_t *>(target->getImpl()), extrinsic, &error);
Error::handle(&error);
}
/**
* @brief Set the extrinsic parameters from current stream profile to the given target stream type.
*
* @tparam targetStreamType Target stream type.
* @tparam extrinsic The extrinsic.
*/
void bindExtrinsicTo(const OBStreamType &targetStreamType, const OBExtrinsic &extrinsic) {
ob_error *error = nullptr;
ob_stream_profile_set_extrinsic_to_type(const_cast<ob_stream_profile_t *>(impl_),targetStreamType,extrinsic, &error);
Error::handle(&error);
}
/**
* @brief Check if frame object is compatible with the given type.
*
* @tparam T Given type
* @return bool return result
* @tparam T Given type.
* @return bool return result.
*/
template <typename T> bool is() const;
/**
* @brief Converts object type to target type
* @brief Converts object type to target type.
*
* @tparam T Target type
* @tparam T Target type.
* @return std::shared_ptr<T> Return the result. Throws an exception if conversion is not possible.
*/
template <typename T> std::shared_ptr<T> as() {
@@ -109,9 +133,9 @@ public:
}
/**
* @brief Converts object type to target type (const version)
* @brief Converts object type to target type (const version).
*
* @tparam T Target type
* @tparam T Target type.
* @return std::shared_ptr<T> Return the result. Throws an exception if conversion is not possible.
*/
template <typename T> std::shared_ptr<const T> as() const {
@@ -192,6 +216,17 @@ public:
return intrinsic;
}
/**
* @brief Set the intrinsic parameters of the stream.
*
* @param intrinsic The intrinsic parameters.
*/
void setIntrinsic(const OBCameraIntrinsic &intrinsic) {
ob_error *error = nullptr;
ob_video_stream_profile_set_intrinsic(const_cast<ob_stream_profile_t *>(impl_), intrinsic, &error);
Error::handle(&error);
}
/**
* @brief Get the distortion parameters of the stream.
* @brief Brown distortion model
@@ -205,6 +240,17 @@ public:
return distortion;
}
/**
* @brief Set the distortion parameters of the stream.
*
* @param distortion The distortion parameters.
*/
void setDistortion(const OBCameraDistortion &distortion) {
ob_error *error = nullptr;
ob_video_stream_profile_set_distortion(const_cast<ob_stream_profile_t *>(impl_), distortion, &error);
Error::handle(&error);
}
public:
// The following interfaces are deprecated and are retained here for compatibility purposes.
uint32_t fps() const {
@@ -113,7 +113,7 @@ public:
* OB_SENSOR_IR_LEFT,
* OB_SENSOR_IR_RIGHT,
*
* @param type
* @param type The sensor type
* @return true
* @return false
*/