update SDK

This commit is contained in:
Joe Dong
2024-04-07 11:00:47 +08:00
parent ee0a2f7011
commit 4ca5c40909
24 changed files with 1953 additions and 2204 deletions
@@ -889,6 +889,94 @@ void ob_device_load_depth_filter_config(ob_device *device, const char *file_path
*/
void ob_device_reset_default_depth_filter_config(ob_device *device, ob_error **error);
/**
* @breif Get the current preset name.
* @brief The preset mean a set of parameters or configurations that can be applied to the device to achieve a specific effect or function.
*
* @param device The device object.
* @param error Log error messages.
* @return The current preset name, it should be one of the preset names returned by @ref ob_device_get_available_preset_list.
*/
const char *ob_device_get_current_preset_name(ob_device *device, ob_error **error);
/**
* @brief Get the available preset list.
* @attention After loading the preset, the settings in the preset will set to the device immediately. Therefore, it is recommended to re-read the device
* settings to update the user program temporarily.
*
* @param device The device object.
* @param preset_name Log error messages. The name should be one of the preset names returned by @ref ob_device_get_available_preset_list.
* @param error Log error messages.
*/
void ob_device_load_preset(ob_device *device, const char *preset_name, ob_error **error);
/**
* @brief Load preset from json string.
* @brief After loading the custom preset, the settings in the custom preset will set to the device immediately.
* @brief After loading the custom preset, the available preset list will be appended with the custom preset and named as the file name.
*
* @param device The device object.
* @param json_file_path The json file path.
* @param error Log error messages.
*/
void ob_device_load_preset_from_json_file(ob_device *device, const char *json_file_path, ob_error **error);
/**
* @brief Export current settings as a preset json file.
* @brief After exporting the custom preset, the available preset list will be appended with the custom preset and named as the file name.
*
* @param device The device object.
* @param json_file_path The json file path.
* @param error Log error messages.
*/
void ob_device_export_current_settings_as_preset_json_file(ob_device *device, const char *json_file_path, ob_error **error);
/**
* @brief Get the available preset list.
*
* @param device The device object.
* @param error Log error messages.
* @return The available preset list.
*/
ob_device_preset_list *ob_device_get_available_preset_list(ob_device *device, ob_error **error);
/**
* @brief Delete the available preset list.
*
* @param preset_list The available preset list.
* @param error Log error messages.
*/
void ob_delete_preset_list(ob_device_preset_list *preset_list, ob_error **error);
/**
* @brief Get the number of preset in the preset list.
*
* @param preset_list The available preset list.
* @param error Log error messages.
* @return The number of preset in the preset list.
*/
uint32_t ob_device_preset_list_count(ob_device_preset_list *preset_list, ob_error **error);
/**
* @brief Get the name of the preset in the preset list.
*
* @param preset_list The available preset list.
* @param index The index of the preset in the preset list.
* @param error Log error messages.
* @return The name of the preset in the preset list.
*/
const char *ob_device_preset_list_get_name(ob_device_preset_list *preset_list, uint32_t index, ob_error **error);
/**
* @brief Check if the preset list has the preset.
*
* @param preset_list The available preset list.
* @param preset_name The name of the preset.
* @param error Log error messages.
* @return Whether the preset list has the preset. If true, the preset list has the preset. If false, the preset list does not have the preset.
*/
bool ob_device_preset_list_has_preset(ob_device_preset_list *preset_list, const char *preset_name, ob_error **error);
#ifdef __cplusplus
}
#endif
@@ -122,6 +122,321 @@ void ob_compression_filter_set_compression_params(ob_filter *filter, ob_compress
*/
ob_filter *ob_create_decompression_filter(ob_error **error);
/**
* @brief Create a HoleFilling Filter.
*
* @param[out] error Log error messages.
*
* @return A depth_filter object.
*/
ob_filter *ob_create_holefilling_filter(ob_error **error);
/**
* @brief Set the HoleFillingFilter mode.
*
* @param[in] filter A holefilling_filter object.
* @param[in] mode holefilling mode OB_HOLE_FILL_TOP,OB_HOLE_FILL_NEAREST or OB_HOLE_FILL_FAREST.
* @param[out] error Log error messages.
*/
void ob_holefilling_filter_set_mode(ob_filter *filter, ob_hole_filling_mode mode, ob_error **error);
/**
* @brief Get the HoleFillingFilter mode.
*
* @param[in] filter A holefilling_filter object.
* @param[out] error Log error messages.
* @return ob_hole_filling_mode
*/
ob_hole_filling_mode ob_holefilling_filter_get_mode(ob_filter *filter, ob_error **error);
/**
* @brief Create a Temporal Filter.
*
* @param[out] error Log error messages.
*
* @return A depth_filter object.
*/
ob_filter *ob_create_temporal_filter(ob_error **error);
/**
* @brief Get the TemporalFilter diffscale range.
*
* @param[in] filter A temporal_filter object.
* @param[out] error Log error messages.
* @return ob_float_property_range the value of property range.
*/
ob_float_property_range ob_temporal_filter_get_diffscale_range(ob_filter *filter, ob_error **error);
/**
* @brief Set the TemporalFilter diffscale value.
*
* @param[in] filter A temporal_filter object.
* @param[in] value diffscale value.
* @param[out] error Log error messages.
*/
void ob_temporal_filter_set_diffscale_value(ob_filter *filter, float value, ob_error **error);
/**
* @brief Get the TemporalFilter weight range.
*
* @param[in] filter A temporal filter object.
* @param[out] error Log error messages.
*/
ob_float_property_range ob_temporal_filter_get_weight_range(ob_filter *filter, ob_error **error);
/**
* @brief Set the TemporalFilter weight range.
*
* @param[in] filter A temporal_filter object.
* @param[in] value weight value.
* @param[out] error Log error messages.
*/
void ob_temporal_filter_set_weight_value(ob_filter *filter, float value, ob_error **error);
/**
* @brief Create a spatial advanced filter.
* @param[out] error Log error messages.
* @return A depth_filter object.
*/
ob_filter *ob_create_spatial_advanced_filter(ob_error **error);
/**
* @brief Get the spatial advanced filter alpha range.
*
* @param[in] filter A spatial advanced filter object.
* @param[out] error Log error messages.
* @return ob_float_property_range the alpha value of property range.
*/
ob_float_property_range ob_spatial_advanced_filter_get_alpha_range(ob_filter *filter, ob_error **error);
/**
* @brief Get the spatial advanced filter disp diff range.
*
* @param[in] filter A spatial advanced filter object.
* @param[out] error Log error messages.
* @return ob_uint16_property_range the dispdiff value of property range.
*/
ob_uint16_property_range ob_spatial_advanced_filter_get_disp_diff_range(ob_filter *filter, ob_error **error);
/**
* @brief Get the spatial advanced filter radius range.
*
* @param[in] filter A spatial advanced filter object.
* @param[out] error Log error messages.
* @return ob_uint16_property_range the radius value of property range.
*/
ob_uint16_property_range ob_spatial_advanced_filter_get_radius_range(ob_filter *filter, ob_error **error);
/**
* @brief Get the spatial advanced filter magnitude range.
*
* @param[in] filter A spatial advanced filter object.
* @param[out] error Log error messages.
* @return ob_int_property_range the magnitude value of property range.
*/
ob_int_property_range ob_spatial_advanced_filter_get_magnitude_range(ob_filter *filter, ob_error **error);
/**
* @brief Get the spatial advanced filter params.
*
* @param[in] filter A spatial advanced filter object.
* @param[out] error Log error messages.
* @return ob_spatial_advanced_filter_params.
*/
ob_spatial_advanced_filter_params ob_spatial_advanced_filter_get_filter_params(ob_filter *filter, ob_error **error);
/**
* @brief Set the spatial advanced filter params.
*
* @param[in] filter A temporal_filter object.
* @param[in] params ob_spatial_advanced_filter_params.
* @param[out] error Log error messages.
*/
void ob_spatial_advanced_filter_set_filter_params(ob_filter *filter, ob_spatial_advanced_filter_params params, ob_error **error);
/**
* @brief Create a noise removal filter.
* @param[out] error Log error messages.
* @return A depth_filter object.
*/
ob_filter *ob_create_noise_removal_filter(ob_error **error);
/**
* @brief Get the noise removal filter disp diff range.
*
* @param[in] filter A noise removal filter object.
* @param[out] error Log error messages.
* @return ob_uint16_property_range the disp_diff value of property range.
*/
ob_uint16_property_range ob_noise_removal_filter_get_disp_diff_range(ob_filter *filter, ob_error **error);
/**
* @brief Get the noise removal filter max size range.
*
* @param[in] filter noise removal filter object.
* @param[out] error Log error messages.
* @return ob_int_property_range the _max_size value of property range.
*/
ob_int_property_range ob_noise_removal_filter_get_max_size_range(ob_filter *filter, ob_error **error);
/**
* @brief Set the noise removal filter params.
*
* @param[in] filter noise removal filter object.
* @param[in] params ob_noise_removal_filter_params.
* @param[out] error Log error messages.
*/
void ob_noise_removal_filter_set_filter_params(ob_filter *filter, ob_noise_removal_filter_params params, ob_error **error);
/**
* @brief Get the noise removal filter params.
*
* @param[in] filter noise removal filter object.
* @param[out] error Log error messages.
* @return ob_noise_removal_filter_params.
*/
ob_noise_removal_filter_params ob_noise_removal_filter_get_filter_params(ob_filter *filter, ob_error **error);
/**
* @brief Create a decimation filter.
* @param[out] error Log error messages.
* @return A depth_filter object.
*/
ob_filter *ob_create_decimation_filter(ob_error **error);
/**
* @brief Get the decimation filter scale range.
*
* @param[in] filter A decimation filter object.
* @param[out] error Log error messages.
*/
ob_uint8_property_range ob_decimation_filter_get_scale_range(ob_filter *filter, ob_error **error);
/**
* @brief Set the decimation filter scale value.
*
* @param[in] filter A decimation object.
* @param[in] value decimation filter scale value.
* @param[out] error Log error messages.
*/
void ob_decimation_filter_set_scale_value(ob_filter *filter, uint8_t value, ob_error **error);
/**
* @brief Get the decimation filter scale value.
*
* @param[in] filter A decimation object.
* @param[out] error Log error messages.
* @return decimation filter scale value.
*/
uint8_t ob_decimation_filter_get_scale_value(ob_filter *filter, ob_error **error);
/**
* @brief Create a threshold filter.
* @param[out] error Log error messages.
* @return A depth_filter object.
*/
ob_filter *ob_create_threshold_filter(ob_error **error);
/**
* @brief Get the threshold filter min range.
*
* @param[in] filter A threshold filter object.
* @param[out] error Log error messages.
*/
ob_int_property_range ob_threshold_filter_get_min_range(ob_filter *filter, ob_error **error);
/**
* @brief Get the threshold filter max range.
*
* @param[in] filter A threshold filter object.
* @param[out] error Log error messages.
*/
ob_int_property_range ob_threshold_filter_get_max_range(ob_filter *filter, ob_error **error);
/**
* @brief Set the threshold filter scale range.
*
* @param[in] filter A threshold object.
* @param[in] min threshold filter scale min value.
* @param[in] max threshold filter scale max value.
* @param[out] error Log error messages.
*/
void ob_threshold_filter_set_scale_value(ob_filter *filter, uint16_t min, uint16_t max, ob_error **error);
/**
* @brief Create a SequenceId filter.
* @param[out] error Log error messages.
* @return A depth_filter object.
*/
ob_filter *ob_create_sequenceId_filter(ob_error **error);
/**
* @brief Set the sequence id filter select sequence id.
*
* @param[in] filter A sequence id object.
* @param[in] sequence_id sequence id to pass the filter.
* @param[out] error Log error messages.
*/
void ob_sequence_id_filter_select_sequence_id(ob_filter *filter, int sequence_id, ob_error **error);
/**
* @brief Get the current sequence id.
*
* @param[in] filter A sequence id object.
* @param[out] error Log error messages.
* @return sequence id to pass the filter.
*/
int ob_sequence_id_filter_get_sequence_id(ob_filter *filter, ob_error **error);
/**
* @brief Get the current sequence id list.
*
* @param[in] filter A sequence id object.
* @param[out] error Log error messages.
*/
ob_sequence_id_item *ob_sequence_id_filter_get_sequence_id_list(ob_filter *filter, ob_error **error);
/**
* @brief Get the current sequence id list size.
*
* @param[in] filter A sequence id object.
* @param[out] error Log error messages.
*/
int ob_sequence_id_filter_get_sequence_id_list_size(ob_filter *filter, ob_error **error);
/**
* @brief Create a hdr merge.
* @param[out] error Log error messages.
* @return A depth_filter object.
*/
ob_filter *ob_create_hdr_merge(ob_error **error);
/**
* @brief Create a align.
* @param[in] align_to_stream ob_stream_type.
* @param[out] error Log error messages.
* @return A depth_filter object.
*/
ob_filter *ob_create_align(ob_error **error, ob_stream_type align_to_stream);
/**
* @brief Get the algin stream type.
*
* @param[in] filter A align object.
* @param[out] error Log error messages.
* @return A ob_stream_type.
*/
ob_stream_type ob_align_get_to_stream_type(ob_filter *filter, ob_error **error);
/**
* @brief Create a disparity transform.
* @param[in] depth_to_disparity disparity to depth, depth to disparity Conversion.
* @param[out] error Log error messages.
* @return A depth_filter object.
*/
ob_filter *ob_create_disparity_transform(ob_error **error, bool depth_to_disparity);
/**
* @brief Reset the filter, clears the cache, and resets the state. If the asynchronous interface is used, the processing thread will also be stopped and the
* pending cache frames will be cleared.
@@ -142,6 +457,25 @@ void ob_filter_reset(ob_filter *filter, ob_error **error);
*/
ob_frame *ob_filter_process(ob_filter *filter, ob_frame *frame, ob_error **error);
/**
* @brief Enable the frame post processing
*
* @param[in] filter A filter object.
* @param[in] enable enable status
* @param[out] error Log error messages.
*/
void ob_filter_enable(ob_filter *filter, bool enable, ob_error **error);
/**
* @brief Get the enable status of the frame post processing
*
* @param[in] filter A filter object.
* @param[out] error Log error messages.
*
* @return The post processing filter status.
*/
bool ob_filter_is_enable(ob_filter *filter, ob_error **error);
/**
* @brief Set the processing result callback function for the filter (asynchronous callback interface).
*
@@ -67,6 +67,9 @@ typedef struct ConfigImpl ob_config;
typedef struct RecorderImpl ob_recorder;
typedef struct PlaybackImpl ob_playback;
typedef struct OBDepthWorkModeListImpl ob_depth_work_mode_list;
typedef struct FilterListImpl ob_filter_list;
typedef struct OBFilterListImpl ob_filters;
typedef struct DevicePresetListImpl ob_device_preset_list;
#define OB_WIDTH_ANY 0
#define OB_HEIGHT_ANY 0
@@ -236,6 +239,8 @@ typedef enum {
OB_FORMAT_YV12 = 29, /**< Is same as Y12, using for right ir stream*/
OB_FORMAT_BA81 = 30, /**< Is same as Y8, using for right ir stream*/
OB_FORMAT_RGBA = 31, /**< RGBA format */
OB_FORMAT_BYR2 = 32, /**< byr2 format */
OB_FORMAT_RW16 = 33, /**< RAW16 format */
OB_FORMAT_UNKNOWN = 0xff, /**< unknown format */
} OBFormat,
ob_format;
@@ -345,10 +350,10 @@ typedef struct {
*/
typedef struct {
uint8_t cur; ///< Current value
uint8_t max; ///< Maximum value
uint8_t min; ///< Minimum value
uint8_t step; ///< Step value
uint8_t def; ///< Default value
uint8_t max; ///< Maximum value
uint8_t min; ///< Minimum value
uint8_t step; ///< Step value
uint8_t def; ///< Default value
} OBUint8PropertyRange, ob_uint8_property_range;
/**
@@ -416,18 +421,20 @@ typedef struct {
/** \brief Distortion model: defines how pixel coordinates should be mapped to sensor coordinates. */
typedef enum {
OB_DISTORTION_NONE, /**< Rectilinear images. No distortion compensation required. */
OB_DISTORTION_MODIFIED_BROWN_CONRADY, /**< Equivalent to Brown-Conrady distortion, except that tangential distortion is applied to radially distorted points */
OB_DISTORTION_INVERSE_BROWN_CONRADY, /**< Equivalent to Brown-Conrady distortion, except undistorts image instead of distorting it */
OB_DISTORTION_BROWN_CONRADY, /**< Unmodified Brown-Conrady distortion model */
} OBCameraDistortionModel, ob_camera_distortion_model;
} OBCameraDistortionModel,
ob_camera_distortion_model;
/** \brief Video stream intrinsics. */
typedef struct {
int width; /**< Width of the image in pixels */
int height; /**< Height of the image in pixels */
float ppx; /**< Horizontal coordinate of the principal point of the image, as a pixel offset from the left edge */
float ppy; /**< Vertical coordinate of the principal point of the image, as a pixel offset from the top edge */
float fx; /**< Focal length of the image plane, as a multiple of pixel width */
float fy; /**< Focal length of the image plane, as a multiple of pixel height */
int width; /**< Width of the image in pixels */
int height; /**< Height of the image in pixels */
float ppx; /**< Horizontal coordinate of the principal point of the image, as a pixel offset from the left edge */
float ppy; /**< Vertical coordinate of the principal point of the image, as a pixel offset from the top edge */
float fx; /**< Focal length of the image plane, as a multiple of pixel width */
float fy; /**< Focal length of the image plane, as a multiple of pixel height */
OBCameraDistortionModel model; /**< Distortion model of the image */
float coeffs[5]; /**< Distortion coefficients. Order for Brown-Conrady: [k1, k2, p1, p2, k3]. Order for F-Theta Fish-eye: [k1, k2, k3, k4, 0]. Other models
are subject to their own interpretations */
@@ -721,7 +728,6 @@ typedef enum {
OB_TOF_FILTER_RANGE_DEBUG = 100, /**< Debug range */
} OBTofFilterRange,
ob_tof_filter_range, TOF_FILTER_RANGE;
/**
* @brief 3D point structure in the SDK
*/
@@ -932,6 +938,14 @@ typedef struct {
char name[32];
} OBDepthWorkMode, ob_depth_work_mode;
/**
* @brief SequenceId fliter list item
*/
typedef struct {
int sequenceSelectId;
char name[8];
} OBSequenceIdItem, ob_sequence_id_item;
/**
* @brief Hole fillig mode
*/
@@ -939,13 +953,14 @@ typedef enum {
OB_HOLE_FILL_TOP = 0,
OB_HOLE_FILL_NEAREST = 1, // "max" means farest for depth, and nearest for disparity; FILL_NEAREST
OB_HOLE_FILL_FAREST = 2, // FILL_FAREST
} OBHoleFillingMode, ob_hole_filling_mode;
} OBHoleFillingMode,
ob_hole_filling_mode;
typedef struct {
uint8_t magnitude; // magnitude
float alpha; // smooth_alpha
uint16_t disp_diff; // smooth_delta
uint16_t radius; // hole_fill
uint8_t magnitude; // magnitude
float alpha; // smooth_alpha
uint16_t disp_diff; // smooth_delta
uint16_t radius; // hole_fill
} OBSpatialAdvancedFilterParams, ob_spatial_advanced_filter_params;
/**
@@ -954,11 +969,12 @@ typedef struct {
typedef enum OB_DDO_NOISE_REMOVAL_TYPE {
OB_NR_LUT = 0, // SPLIT
OB_NR_OVERALL = 1, // NON_SPLIT
} OBDDONoiseRemovalType, ob_ddo_noise_removal_type;
} OBDDONoiseRemovalType,
ob_ddo_noise_removal_type;
typedef struct {
uint16_t size;
uint16_t disp_diff;
uint16_t max_size;
uint16_t disp_diff;
OBDDONoiseRemovalType type;
} OBNoiseRemovalFilterParams, ob_noise_removal_filter_params;
;
@@ -1583,6 +1599,7 @@ typedef enum {
/**
* @brief The number of frame metadata types, using for types iterating
* @attention It is not a valid frame metadata type
*/
OB_FRAME_METADATA_TYPE_COUNT,
} ob_frame_metadata_type,
@@ -179,7 +179,7 @@ typedef enum {
OB_PROP_INDICATOR_LIGHT_BOOL = 83,
/**
* @brief Disparity to depth switch, 0: off, the depth stream outputs the disparity map; 1. On, the depth stream outputs the depth map.
* @brief Disparity to depth switch, false: switch to software disparity convert to depth, true: switch to hardware disparity convert to depth
*/
OB_PROP_DISPARITY_TO_DEPTH_BOOL = 85,
@@ -407,6 +407,11 @@ typedef enum {
*/
OB_PROP_LASER_CONTROL_INT = 182,
/**
* @brief IR brightness
*/
OB_PROP_IR_BRIGHTNESS_INT = 184,
/**
* @brief Baseline calibration parameters
*/
@@ -28,6 +28,52 @@ ob_sensor_type ob_sensor_get_type(ob_sensor *sensor, ob_error **error);
*/
ob_stream_profile_list *ob_sensor_get_stream_profile_list(ob_sensor *sensor, ob_error **error);
/**
* @brief Request the list of recommended filter list
*
* @param[in] sensor The ob_sensor object.
* @param[out] error Log error messages.
*
* @return ob_filter_list
*/
ob_filter_list *ob_sensor_get_recommended_filter_list(ob_sensor *sensor, ob_error **error);
/**
* @brief Get the number of recommended filter list
*
* @param ob_filter_list Recommended filter list
* @param error Log error messages
* @return uint32_t The number of list
*/
uint32_t ob_filter_list_get_count(ob_filter_list *filter_list, ob_error **error);
/**
* @brief Get the number of recommended filter list
*
* @param ob_filter_list Recommended filter list
* @param index Recommended filter index
* @param error Log error messages
* @return ob_filter The index of ob_filter
*/
ob_filter *ob_get_filter(ob_filter_list *filter_list, uint32_t index, ob_error **error);
/**
* @brief Get the name of ob_filter
*
* @param filter ob_filter object
* @param error Log error messages
* @return char The filter of name
*/
const char *ob_get_filter_name(ob_filter *filter, ob_error **error);
/**
* @brief Delete a list of ob_filter objects.
*
* @param[in] filter_list The list of ob_filter objects to delete.
* @param[out] error Logs error messages.
*/
void ob_delete_filter_list(ob_filter_list *filter_list, ob_error **error);
/**
* @brief Open the current sensor and set the callback data frame.
*
@@ -7,7 +7,7 @@
#include "Types.hpp"
#include "libobsensor/h/Property.h"
#include "libobsensor/hpp/Filter.hpp"
#include <memory>
#include <string>
#include <vector>
@@ -24,6 +24,7 @@ class DeviceInfo;
class Sensor;
class CameraParamList;
class OBDepthWorkModeList;
class DevicePresetList;
class OB_EXTENSION_API Device {
protected:
@@ -550,6 +551,48 @@ public:
*/
void resetDefaultDepthFilterConfig();
/**
* @brief Get current preset name
* @brief The preset mean a set of parameters or configurations that can be applied to the device to achieve a specific effect or function.
* @return const char* return the current preset name, it should be one of the preset names returned by @ref getAvailablePresetList.
*/
const char *getCurrentPresetName();
/**
* @brief load the preset according to the preset name.
* @attention After loading the preset, the settings in the preset will set to the device immediately. Therefore, it is recommended to re-read the device
* settings to update the user program temporarily.
* @param presetName The preset name to set. The name should be one of the preset names returned by @ref getAvailablePresetList.
*/
void loadPreset(const char *presetName);
/**
* @brief Get available preset list
* @brief The available preset list usually defined by the device manufacturer and restores on the device.
* @brief User can load the custom preset by calling @ref loadPresetFromJsonFile to append the available preset list.
*
* @return DevicePresetList return the available preset list.
*/
std::shared_ptr<DevicePresetList> getAvailablePresetList();
/**
* @brief Load custom preset from file.
* @brief After loading the custom preset, the settings in the custom preset will set to the device immediately.
* @brief After loading the custom preset, the available preset list will be appended with the custom preset and named as the file name.
*
* @attention The user should ensure that the custom preset file is adapted to the device and the settings in the file are valid.
* @attention It is recommended to re-read the device settings to update the user program temporarily after successfully loading the custom preset.
*
* @param filePath The path of the custom preset file.
*/
void loadPresetFromJsonFile(const char *filePath);
/**
* @brief Export current device settings as a preset json file.
* @brief The exported preset file can be loaded by calling @ref loadPresetFromJsonFile to restore the device setting.
*/
void exportSettingsAsPresetJsonFile(const char *filePath);
friend class Pipeline;
friend class Recorder;
friend class CoordinateTransformHelper;
@@ -852,4 +895,39 @@ public:
OBDepthWorkMode operator[](uint32_t index);
};
/**
* @brief Class representing a list of device presets
* @breif A device preset is a set of parameters or configurations that can be applied to the device to achieve a specific effect or function.
*/
class OB_EXTENSION_API DevicePresetList {
private:
std::unique_ptr<DevicePresetListImpl> impl_;
public:
DevicePresetList(std::unique_ptr<DevicePresetListImpl> impl);
~DevicePresetList() noexcept;
/**
* @brief Get the number of device presets in the list
*
* @return uint32_t the number of device presets in the list
*/
uint32_t count();
/**
* @brief Get the name of the device preset at the specified index
*
* @param index the index of the device preset
* @return const char* the name of the device preset
*/
const char *getName(uint32_t index);
/**
* @breif check if the preset list contains the special name preset.
* @param name The name of the preset
* @return bool Returns true if the special name is found in the preset list, otherwise returns false.
*/
bool hasPreset(const char *name);
};
} // namespace ob
@@ -9,9 +9,12 @@
#include <functional>
#include <memory>
#include <map>
#include <string>
#include <iostream>
namespace ob {
class Frame;
class OBFilterList;
/**
* @brief A callback function that takes a shared pointer to a Frame object as its argument.
@@ -21,10 +24,12 @@ typedef std::function<void(std::shared_ptr<Frame>)> FilterCallback;
/**
* @brief The Filter class is the base class for all filters in the SDK.
*/
class OB_EXTENSION_API Filter {
class OB_EXTENSION_API Filter : public std::enable_shared_from_this<Filter> {
public:
Filter();
Filter(std::shared_ptr<FilterImpl> impl);
virtual ~Filter() = default;
/**
@@ -33,6 +38,16 @@ public:
*/
virtual void reset();
/**
* @brief enable the filter
*/
void enable(bool enable);
/**
* @brief Return Enable State
*/
bool isEnabled();
/**
* @brief Processes a frame synchronously.
*
@@ -55,8 +70,40 @@ public:
*/
virtual void setCallBack(FilterCallback callback);
/**
* @brief Get the type of filter.
*
* @return string The type of filte.
*/
virtual const char *type();
/**
* @brief Check if the runtime type of the filter object is compatible with a given type.
*
* @tparam T The given type.
* @return bool The result.
*/
template <typename T> bool is();
/**
* @brief Convert the filter object to a target type.
*
* @tparam T The target type.
* @return std::shared_ptr<T> The result. If it cannot be converted, an exception will be thrown.
*/
template <typename T> std::shared_ptr<T> as() {
if(!is<T>()) {
throw std::runtime_error("unsupported operation, object's type is not require type");
}
return std::static_pointer_cast<T>(shared_from_this());
}
protected:
std::shared_ptr<FilterImpl> impl_;
std::string type_;
friend class OBFilterList;
};
/**
@@ -152,17 +199,26 @@ public:
};
/**
* @brief Hole filling filter
* @brief Hole filling filter,the processing performed depends on the selected hole filling mode.
*/
class OB_EXTENSION_API HoleFillingFilter : public Filter {
public:
HoleFillingFilter();
void enable(bool enable);
bool isEnabled();
/**
* @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);
/**
* @brief Get the HoleFillingFilter mode.
*
* @return OBHoleFillingMode
*/
OBHoleFillingMode getFilterMode();
};
/**
@@ -172,41 +228,84 @@ class OB_EXTENSION_API TemporalFilter : public Filter {
public:
TemporalFilter();
void enable(bool enable);
bool isEnabled();
/**
* @brief Get the TemporalFilter diffscale range.
*
* @return OBFloatPropertyRange the diffscale value of property range.
*/
OBFloatPropertyRange getDiffScaleRange();
/**
* @brief Set the TemporalFilter diffscale value.
*
* @param value diffscale value.
*/
void setDiffScale(float value);
/**
* @brief Get the TemporalFilter weight range.
*
* @return OBFloatPropertyRange the weight value of property range.
*/
OBFloatPropertyRange getWeightRange();
/**
* @brief Set the TemporalFilter weight value.
*
* @param value weight value.
*/
void setWeight(float value);
};
/**
* @brief Spatial advanced filter
* @brief Spatial advanced filte smooths the image by calculating frame with alpha and delta settings
* alpha defines the weight of the current pixel for smoothing,
* delta defines the depth gradient below which the smoothing will occur as number of depth levels.
*/
class OB_EXTENSION_API SpatialAdvancedFilter : public Filter {
public:
SpatialAdvancedFilter();
void enable(bool enable);
bool isEnabled();
/**
* @brief Get the spatial advanced filter alpha range.
*
* @return OBFloatPropertyRange the alpha value of property range.
*/
OBFloatPropertyRange getAlphaRange();
/**
* @brief Get the spatial advanced filter dispdiff range.
*
* @return OBFloatPropertyRange the dispdiff value of property range.
*/
OBUint16PropertyRange getDispDiffRange();
/**
* @brief Get the spatial advanced filter radius range.
*
* @return OBFloatPropertyRange the radius value of property range.
*/
OBUint16PropertyRange getRadiusRange();
/**
* @brief Get the spatial advanced filter magnitude range.
*
* @return OBFloatPropertyRange the magnitude value of property range.
*/
OBIntPropertyRange getMagnitudeRange();
/**
* @brief Get the spatial advanced filter params.
*
* @return OBSpatialAdvancedFilterParams
*/
OBSpatialAdvancedFilterParams getFilterParams();
/**
* @brief Set the spatial advanced filter params.
*
* @param params OBSpatialAdvancedFilterParams.
*/
void setFilterParams(OBSpatialAdvancedFilterParams params);
};
@@ -215,25 +314,22 @@ public:
*/
class OB_EXTENSION_API DisparityTransform : public Filter {
public:
DisparityTransform();
/**
* @brief Create a disparity transform.
* @param depth_to_disparity disparity to depth or depth to disparity Conversion.
*/
DisparityTransform(bool depth_to_disparity);
void enable(bool enable);
bool isEnabled();
};
/**
* @brief Depth HDR merge
* @brief HdrMerge processing block,
* the processing merges between depth frames with
* different sub-preset sequence ids.
*/
class OB_EXTENSION_API HdrMerge : public Filter {
public:
HdrMerge();
void enable(bool enable);
bool isEnabled();
};
/**
@@ -241,11 +337,18 @@ public:
*/
class OB_EXTENSION_API Align : public Filter {
public:
Align(OBStreamType align_to_stream, OBFrameType align_to_frame);
/**
* @brief Creaet Align filter.
* @param OBStreamType alignment is performed between a depth image and another image.
*/
Align(OBStreamType align_to_stream);
void enable(bool enable);
bool isEnabled();
/**
* @brief Get the stream type to be aligned with.
*
* @return OBStreamType The stream type of align to.
*/
OBStreamType getAlignToStreamType();
};
/**
@@ -256,67 +359,167 @@ class OB_EXTENSION_API ThresholdFilter : public Filter {
public:
ThresholdFilter();
void enable(bool enable);
bool isEnabled();
/**
* @brief Get the threshold filter min range.
*
* @return OBIntPropertyRange The range of the threshold filter min.
*/
OBIntPropertyRange getMinRange();
/**
* @brief Get the threshold filter max range.
*
* @return OBIntPropertyRange The range of the threshold filter max.
*/
OBIntPropertyRange getMaxRange();
/**
* @brief Get the threshold filter max and min range.
*/
void setValueRange(uint16_t min, uint16_t max);
};
/**
* @brief
* @brief Create SequenceIdFilter processing block.
*/
class OB_EXTENSION_API SequenceIdFilter : public Filter {
public:
SequenceIdFilter();
void enable(bool enable);
/**
* @brief Set the sequenceId filter params.
*
* @param sequence id to pass the filter.
*/
void selectSequenceId(int sequence_id);
bool isEnabled();
/**
* @brief Get the current sequence id.
*
* @return sequence id to pass the filter.
*/
int getSelectSequenceId();
void selectSequenceId(float sequence_id);
/**
* @brief Get the current sequence id list.
*
* @return OBSequenceIdItem.
*/
OBSequenceIdItem *getSequenceIdList();
float getSelectSequenceId();
std::map<float, std::string> getSequenceIdList();
/**
* @brief Get the sequenceId list size.
*
* @return the size of sequenceId list.
*/
int getSequenceIdListSize();
};
/**
* @brief
* @brief The noise removal filter,removing scattering depth pixels.
*/
class OB_EXTENSION_API NoiseRemovalFilter : public Filter {
public:
NoiseRemovalFilter();
void enable(bool enable);
/**
* @brief Set the noise removal filter params.
*
* @param[in] params ob_noise_removal_filter_params.
*/
void setFilterParams(OBNoiseRemovalFilterParams filterParams);
bool isEnabled();
void setNoiseRemovalFilterParams(OBNoiseRemovalFilterParams *filterParams);
/**
* @brief Get the noise removal filter params.
*
* @return OBNoiseRemovalFilterParams.
*/
OBNoiseRemovalFilterParams getFilterParams();
/**
* @brief Get the noise removal filter disp diff range.
* @return OBUint16PropertyRange The disp diff of property range.
*/
OBUint16PropertyRange getDispDiffRange();
OBUint16PropertyRange getSizeRange();
/**
* @brief Get the noise removal filter max size range.
* @return OBUint16PropertyRange The max size of property range.
*/
OBUint16PropertyRange getMaxSizeRange();
};
/**
* @brief
* @brief Decimation filter,reducing complexity by subsampling depth maps and losing depth details.
*/
class OB_EXTENSION_API DecimationFilter : public Filter {
public:
DecimationFilter();
void enable(bool enable);
bool isEnabled();
/**
* @brief Set the decimation filter scale value.
*
* @param type The decimation filter scale value.
*/
void setScaleValue(uint8_t value);
/**
* @brief Get the decimation filter scale value.
*/
uint8_t getScaleValue();
/**
* @brief Get the property range of the decimation filter scale value.
*/
OBUint8PropertyRange getScaleRange();
};
// Define the is() template function for the Filter class
template <typename T> bool Filter::is() {
std::string name = type();
if(name == "HdrMerge") {
return typeid(T) == typeid(HdrMerge);
}
if(name == "SequenceIdFilter") {
return typeid(T) == typeid(SequenceIdFilter);
}
if(name == "ThresholdFilter") {
return typeid(T) == typeid(ThresholdFilter);
}
if(name == "DisparityTransform") {
return typeid(T) == typeid(DisparityTransform);
}
if(name == "NoiseRemovalFilter") {
return typeid(T) == typeid(NoiseRemovalFilter);
}
if(name == "SpatialAdvancedFilter") {
return typeid(T) == typeid(SpatialAdvancedFilter);
}
if(name == "TemporalFilter") {
return typeid(T) == typeid(TemporalFilter);
}
if(name == "HoleFillingFilter") {
return typeid(T) == typeid(HoleFillingFilter);
}
if(name == "DecimationFilter") {
return typeid(T) == typeid(DecimationFilter);
}
if(name == "PointCloudFilter") {
return typeid(T) == typeid(PointCloudFilter);
}
if(name == "CompressionFilter") {
return typeid(T) == typeid(CompressionFilter);
}
if(name == "DecompressionFilter") {
return typeid(T) == typeid(DecompressionFilter);
}
if(name == "FormatConverter") {
return typeid(T) == typeid(FormatConvertFilter);
}
if(name == "Align") {
return typeid(T) == typeid(Align);
}
return false;
}
} // namespace ob
@@ -5,6 +5,7 @@
#pragma once
#include "Types.hpp"
#include "libobsensor/hpp/Filter.hpp"
#include <functional>
#include <memory>
@@ -18,6 +19,7 @@ class StreamProfileList;
class Device;
class Frame;
class ImuFrame;
class OBFilterList;
/**
* @brief Callback function for frame data.
@@ -48,6 +50,12 @@ public:
*/
const std::shared_ptr<StreamProfileList> getStreamProfileList();
/**
* @brief Request recommended filters
* @return OBFilterList list of frame processing block
*/
const std::shared_ptr<OBFilterList> getRecommendedFilters();
/**
* @brief Open a frame data stream and set up a callback.
*
@@ -109,4 +117,33 @@ public:
*/
std::shared_ptr<Sensor> getSensor(OBSensorType sensorType);
};
/**
* @brief Class representing a list of FrameProcessingBlock
*/
class OB_EXTENSION_API OBFilterList {
private:
std::unique_ptr<OBFilterListImpl> impl_;
public:
OBFilterList(std::unique_ptr<OBFilterListImpl> impl_);
~OBFilterList() noexcept;
/**
* @brief Get the number of OBDepthWorkMode FrameProcessingBlock in the list
*
* @return uint32_t the number of FrameProcessingBlock objects in the list
*/
uint32_t count();
/**
* @brief Get the Filter object at the specified index
*
* @param index the index of the target Filter object
* @return the Filter object at the specified index
*/
std::shared_ptr<Filter> getFilter(uint32_t index);
};
} // namespace ob
@@ -1 +1 @@
libOrbbecSDK.so.1.9.4
libOrbbecSDK.so.1.9.2
-1
View File
@@ -1 +0,0 @@
libudev.so.1.6.3
-1
View File
@@ -1 +0,0 @@
libudev.so.1.6.3
Binary file not shown.
@@ -1 +1 @@
libOrbbecSDK.so.1.9.4
libOrbbecSDK.so.1.9.2
-1
View File
@@ -1 +0,0 @@
libudev.so.1.6.3
-1
View File
@@ -1 +0,0 @@
libudev.so.1.6.3
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff
@@ -111,6 +111,7 @@ const int32_t OPENNI_END_PID = 0x06FF;
const int32_t ASTRA_MINI_PID = 0x0404;
const int32_t ASTRA_MINI_S_PID = 0x0407;
const int GEMINI2_PID = 0x0670;
const int GEMINI2R_PID = 0x06d0;
const std::string ORB_DEFAULT_LOCK_NAME = "orbbec_device_lock";
} // namespace orbbec_camera
@@ -467,7 +467,7 @@ class OBCameraNode {
std::condition_variable colorFrameCV_;
bool ordered_pc_ = false;
bool use_hardware_time_ = false;
bool use_hardware_time_ = true;
bool enable_depth_scale_ = true;
};
} // namespace orbbec_camera
+138
View File
@@ -0,0 +1,138 @@
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import PushRosNamespace
from launch.actions import GroupAction
from launch_ros.actions import ComposableNodeContainer
from launch_ros.descriptions import ComposableNode
from launch_ros.actions import Node
import os
def generate_launch_description():
# Declare arguments
args = [
DeclareLaunchArgument('camera_name', default_value='camera'),
DeclareLaunchArgument('depth_registration', default_value='false'),
DeclareLaunchArgument('serial_number', default_value=''),
DeclareLaunchArgument('usb_port', default_value=''),
DeclareLaunchArgument('device_num', default_value='1'),
DeclareLaunchArgument('vendor_id', default_value='0x2bc5'),
DeclareLaunchArgument('product_id', default_value=''),
DeclareLaunchArgument('point_cloud_qos', default_value='default'),
DeclareLaunchArgument('connection_delay', default_value='100'),
DeclareLaunchArgument('color_width', default_value='1280'),
DeclareLaunchArgument('color_height', default_value='720'),
DeclareLaunchArgument('color_fps', default_value='30'),
DeclareLaunchArgument('color_format', default_value='MJPG'),
DeclareLaunchArgument('enable_color', default_value='true'),
DeclareLaunchArgument('flip_color', default_value='false'),
DeclareLaunchArgument('color_qos', default_value='default'),
DeclareLaunchArgument('color_camera_info_qos', default_value='default'),
DeclareLaunchArgument('enable_color_auto_exposure', default_value='true'),
DeclareLaunchArgument('depth_width', default_value='848'),
DeclareLaunchArgument('depth_height', default_value='480'),
DeclareLaunchArgument('depth_fps', default_value='30'),
DeclareLaunchArgument('depth_format', default_value='Y16'),
DeclareLaunchArgument('enable_depth', default_value='true'),
DeclareLaunchArgument('flip_depth', default_value='false'),
DeclareLaunchArgument('depth_qos', default_value='default'),
DeclareLaunchArgument('depth_camera_info_qos', default_value='default'),
DeclareLaunchArgument('left_ir_width', default_value='848'),
DeclareLaunchArgument('left_ir_height', default_value='480'),
DeclareLaunchArgument('left_ir_fps', default_value='30'),
DeclareLaunchArgument('left_ir_format', default_value='Y8'),
DeclareLaunchArgument('enable_left_ir', default_value='true'),
DeclareLaunchArgument('flip_left_ir', default_value='false'),
DeclareLaunchArgument('left_ir_qos', default_value='default'),
DeclareLaunchArgument('left_ir_camera_info_qos', default_value='default'),
DeclareLaunchArgument('right_ir_width', default_value='848'),
DeclareLaunchArgument('right_ir_height', default_value='480'),
DeclareLaunchArgument('right_ir_fps', default_value='30'),
DeclareLaunchArgument('right_ir_format', default_value='Y8'),
DeclareLaunchArgument('enable_right_ir', default_value='true'),
DeclareLaunchArgument('flip_right_ir', default_value='false'),
DeclareLaunchArgument('right_ir_qos', default_value='default'),
DeclareLaunchArgument('right_ir_camera_info_qos', default_value='default'),
DeclareLaunchArgument('enable_ir_auto_exposure', default_value='true'),
DeclareLaunchArgument('enable_sync_output_accel_gyro', default_value='false'),
DeclareLaunchArgument('enable_accel', default_value='true'),
DeclareLaunchArgument('accel_rate', default_value='200hz'),
DeclareLaunchArgument('accel_range', default_value='4g'),
DeclareLaunchArgument('enable_gyro', default_value='true'),
DeclareLaunchArgument('gyro_rate', default_value='200hz'),
DeclareLaunchArgument('gyro_range', default_value='1000dps'),
DeclareLaunchArgument('liner_accel_cov', default_value='0.01'),
DeclareLaunchArgument('angular_vel_cov', default_value='0.01'),
DeclareLaunchArgument('publish_tf', default_value='true'),
DeclareLaunchArgument('tf_publish_rate', default_value='10.0'),
DeclareLaunchArgument('ir_info_url', default_value=''),
DeclareLaunchArgument('color_info_url', default_value=''),
DeclareLaunchArgument('log_level', default_value='none'),
DeclareLaunchArgument('enable_publish_extrinsic', default_value='false'),
DeclareLaunchArgument('enable_d2c_viewer', default_value='false'),
DeclareLaunchArgument('enable_ldp', default_value='true'),
DeclareLaunchArgument('enable_soft_filter', default_value='true'),
DeclareLaunchArgument('soft_filter_max_diff', default_value='-1'),
DeclareLaunchArgument('soft_filter_speckle_size', default_value='-1'),
DeclareLaunchArgument('sync_mode', default_value='free_run'),
DeclareLaunchArgument('depth_delay_us', default_value='0'),
DeclareLaunchArgument('color_delay_us', default_value='0'),
DeclareLaunchArgument('trigger2image_delay_us', default_value='0'),
DeclareLaunchArgument('trigger_out_delay_us', default_value='0'),
DeclareLaunchArgument('trigger_out_enabled', default_value='false'),
DeclareLaunchArgument('enable_frame_sync', default_value='true'),
DeclareLaunchArgument('ordered_pc', default_value='false'),
DeclareLaunchArgument('use_hardware_time', default_value='true'),
DeclareLaunchArgument('enable_depth_scale', default_value='true'),
]
# Node configuration
parameters = [{arg.name: LaunchConfiguration(arg.name)} for arg in args]
# get ROS_DISTRO
ros_distro = os.environ["ROS_DISTRO"]
if ros_distro == "foxy":
return LaunchDescription(
args
+ [
Node(
package="orbbec_camera",
executable="orbbec_camera_node",
name="ob_camera_node",
namespace=LaunchConfiguration("camera_name"),
parameters=parameters,
output="screen",
)
]
)
# Define the ComposableNode
else:
# Define the ComposableNode
compose_node = ComposableNode(
package="orbbec_camera",
plugin="orbbec_camera::OBCameraNodeDriver",
name=LaunchConfiguration("camera_name"),
namespace="",
parameters=parameters,
)
# Define the ComposableNodeContainer
container = ComposableNodeContainer(
name="camera_container",
namespace="",
package="rclcpp_components",
executable="component_container",
composable_node_descriptions=[
compose_node,
],
output="screen",
)
# Launch description
ld = LaunchDescription(
args
+ [
GroupAction(
[PushRosNamespace(LaunchConfiguration("camera_name")), container]
)
]
)
return ld
+5 -7
View File
@@ -602,7 +602,7 @@ void OBCameraNode::getParameters() {
setAndGetNodeParameter<double>(angular_vel_cov_, "angular_vel_cov", 0.02);
setAndGetNodeParameter<bool>(ordered_pc_, "ordered_pc", false);
setAndGetNodeParameter<int>(max_save_images_count_, "max_save_images_count", 10);
setAndGetNodeParameter<bool>(use_hardware_time_, "use_hardware_time", false);
setAndGetNodeParameter<bool>(use_hardware_time_, "use_hardware_time", true);
setAndGetNodeParameter<bool>(enable_depth_scale_, "enable_depth_scale", true);
}
@@ -622,7 +622,8 @@ void OBCameraNode::setupPipelineConfig() {
pipeline_config_->setDepthScaleRequire(enable_depth_scale_);
if (depth_registration_ && enable_stream_[COLOR] && enable_stream_[DEPTH]) {
auto info = device_->getDeviceInfo();
if (info->pid() == FEMTO_BOLT_PID) {
auto pid = info->pid();
if (pid == FEMTO_BOLT_PID || pid == GEMINI2R_PID) {
RCLCPP_INFO_STREAM(logger_, "set align mode ALIGN_D2C_SW_MODE.");
pipeline_config_->setAlignMode(ALIGN_D2C_SW_MODE);
} else {
@@ -1169,15 +1170,12 @@ void OBCameraNode::onNewFrameCallback(const std::shared_ptr<ob::Frame> &frame,
int height = static_cast<int>(video_frame->height());
auto timestamp = use_hardware_time_ ? fromUsToROSTime(video_frame->timeStampUs())
: fromMsToROSTime(video_frame->systemTimeStamp());
if (!camera_param_) {
camera_param_ = pipeline_->getCameraParam();
}
auto stream_profile = frame->getStreamProfile();
CHECK_NOTNULL(stream_profile);
auto video_stream_profile = stream_profile->as<ob::VideoStreamProfile>();
CHECK_NOTNULL(video_stream_profile);
const auto& intrinsic = video_stream_profile->getIntrinsic();
const auto& distortion = video_stream_profile->getDistortion();
const auto &intrinsic = video_stream_profile->getIntrinsic();
const auto &distortion = video_stream_profile->getDistortion();
std::string frame_id =
depth_registration_ ? depth_aligned_frame_id_[stream_index] : optical_frame_id_[stream_index];
auto camera_info = convertToCameraInfo(intrinsic, distortion, width);