mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-04 20:17:47 +08:00
Update Orbbec SDK to version 2.4.10 and modify related configurations
- Updated the OrbbecSDKConfig-release.cmake files for both arm64 and x64 architectures to reference the new SDK version 2.4.10. - Replaced occurrences of 'depth_brightness' with 'mean_intensity_set_point' in launch files and the camera node header to improve clarity and consistency. - Added new spatial filtering options (SpatialFastFilter and SpatialModerateFilter) in the camera node implementation, including parameters for radius, magnitude, and difference threshold. - Updated the setupDevices and setupDepthPostProcessFilter methods to handle the new mean intensity setting and spatial filter parameters. - Modified launch files for various examples to reflect the new argument names and added new parameters for spatial filtering.
This commit is contained in:
@@ -382,9 +382,10 @@ ros2 launch orbbec_camera gemini_330_series.launch.py enable_color:=true color_w
|
|||||||
* **enable_depth_auto_exposure_priority**
|
* **enable_depth_auto_exposure_priority**
|
||||||
* Enable the Depth auto exposure priority
|
* Enable the Depth auto exposure priority
|
||||||
* For example:`enable_depth_auto_exposure_priority:=true`
|
* For example:`enable_depth_auto_exposure_priority:=true`
|
||||||
* **depth_brightness**
|
* **mean_intensity_set_point**
|
||||||
* Set the Depth brightness
|
* Set the target mean intensity of the Depth image
|
||||||
* For example:`depth_brightness:=100`
|
* For example: `mean_intensity_set_point:=100`
|
||||||
|
* **Note:** This parameter replaces the deprecated `depth_brightness`.
|
||||||
|
|
||||||
[......](./docs/launch_parameters.md)
|
[......](./docs/launch_parameters.md)
|
||||||
|
|
||||||
|
|||||||
@@ -299,6 +299,14 @@ ros2 service call /camera/set_filter orbbec_camera_msgs/srv/SetFilter '{filter_
|
|||||||
|
|
||||||
#set HardwareNoiseRemoval
|
#set HardwareNoiseRemoval
|
||||||
ros2 service call /camera/set_filter orbbec_camera_msgs/srv/SetFilter '{filter_name: HardwareNoiseRemoval,filter_enable: true,filter_param: []}'
|
ros2 service call /camera/set_filter orbbec_camera_msgs/srv/SetFilter '{filter_name: HardwareNoiseRemoval,filter_enable: true,filter_param: []}'
|
||||||
|
|
||||||
|
# Set SpatialFastFilter
|
||||||
|
# filter_param: [radius]
|
||||||
|
ros2 service call /camera/set_filter orbbec_camera_msgs/srv/SetFilter '{filter_name: SpatialFastFilter, filter_enable: true, filter_param: [4]}'
|
||||||
|
|
||||||
|
# Set SpatialModerateFilter
|
||||||
|
# filter_param: [disp_diff, magnitude, radius, ]
|
||||||
|
ros2 service call /camera/set_filter orbbec_camera_msgs/srv/SetFilter '{filter_name: SpatialModerateFilter, filter_enable: true, filter_param: [160,1,3]}'
|
||||||
```
|
```
|
||||||
|
|
||||||
* `/camera/set_floor_enable`
|
* `/camera/set_floor_enable`
|
||||||
|
|||||||
@@ -78,8 +78,9 @@ The following are the launch parameters available:
|
|||||||
* Set the Color decimation filter scale
|
* Set the Color decimation filter scale
|
||||||
* **enable_depth_auto_exposure_priority**
|
* **enable_depth_auto_exposure_priority**
|
||||||
* Enable the Depth auto exposure priority
|
* Enable the Depth auto exposure priority
|
||||||
* **depth_brightness**
|
* **mean_intensity_set_point**
|
||||||
* Set the Depth brightness
|
* Set the target mean intensity of the Depth image
|
||||||
|
* **Note:** This parameter replaces the deprecated `depth_brightness`.
|
||||||
* **enable_ir_auto_exposure**
|
* **enable_ir_auto_exposure**
|
||||||
* Enable the IR auto exposure
|
* Enable the IR auto exposure
|
||||||
* **ir_exposure**
|
* **ir_exposure**
|
||||||
@@ -185,6 +186,10 @@ The following are the launch parameters available:
|
|||||||
* Enable the Depth temporal filter.The Depth temporal filter setting parameter is `temporal_filter_diff_threshold`,`temporal_filter_weight`
|
* Enable the Depth temporal filter.The Depth temporal filter setting parameter is `temporal_filter_diff_threshold`,`temporal_filter_weight`
|
||||||
* **enable_hole_filling_filter**
|
* **enable_hole_filling_filter**
|
||||||
* Enable the Depth hole filling filter.The Depth hole filling filter setting parameter is `hole_filling_filter_mode`
|
* Enable the Depth hole filling filter.The Depth hole filling filter setting parameter is `hole_filling_filter_mode`
|
||||||
|
* **enable_spatial_fast_filter**
|
||||||
|
- Enable the Depth spatial fast filter. The Depth spatial fast filter setting parameter is `spatial_fast_filter_radius`.
|
||||||
|
* **enable_spatial_moderate_filter**
|
||||||
|
- Enable the Depth spatial moderate filter. The Depth spatial moderate filter setting parameters are `spatial_moderate_filter_diff_threshold`, `spatial_moderate_filter_magnitude`, `spatial_moderate_filter_radius`.
|
||||||
* **align_mode**
|
* **align_mode**
|
||||||
* The alignment mode to be used. Options are `HW` for hardware alignment and `SW` for software alignment
|
* The alignment mode to be used. Options are `HW` for hardware alignment and `SW` for software alignment
|
||||||
* **align_target_stream**
|
* **align_target_stream**
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ OB_EXPORT ob_depth_work_mode ob_depth_work_mode_list_get_item(const ob_depth_wor
|
|||||||
OB_EXPORT void ob_delete_depth_work_mode_list(ob_depth_work_mode_list *work_mode_list, ob_error **error);
|
OB_EXPORT void ob_delete_depth_work_mode_list(ob_depth_work_mode_list *work_mode_list, ob_error **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @breif Get the current preset name.
|
* @brief 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.
|
* @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 device The device object.
|
||||||
@@ -273,7 +273,7 @@ OB_EXPORT bool ob_device_frame_interleave_list_has_frame_interleave(ob_device_fr
|
|||||||
*
|
*
|
||||||
* @param device The device object.
|
* @param device The device object.
|
||||||
* @param error Log error messages.
|
* @param error Log error messages.
|
||||||
* @return The available frame interleave list.
|
* @return The available frame resolution config list.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
OB_EXPORT ob_preset_resolution_config_list *ob_device_get_available_preset_resolution_config_list(ob_device *device, ob_error **error);
|
OB_EXPORT ob_preset_resolution_config_list *ob_device_get_available_preset_resolution_config_list(ob_device *device, ob_error **error);
|
||||||
@@ -294,7 +294,7 @@ OB_EXPORT uint32_t ob_device_preset_resolution_config_get_count(ob_preset_resolu
|
|||||||
* @param error Log error messages.
|
* @param error Log error messages.
|
||||||
* @return The preset resolution in the preset resolution list.
|
* @return The preset resolution in the preset resolution list.
|
||||||
*/
|
*/
|
||||||
OB_EXPORT OBPresetResolutionConfig ob_device_preset_resolution_config_list_get_item(const ob_preset_resolution_config_list *ob_preset_resolution_config_lis,
|
OB_EXPORT OBPresetResolutionConfig ob_device_preset_resolution_config_list_get_item(const ob_preset_resolution_config_list *ob_preset_resolution_config_list,
|
||||||
uint32_t index, ob_error **error);
|
uint32_t index, ob_error **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ OB_EXPORT ob_filter_config_schema_item ob_filter_config_schema_list_get_item(con
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the align to stream profile for the align filter.
|
* @brief Set the align to stream profile for the align filter.
|
||||||
* @breif It is useful when the align target stream dose not started (without any frame to get intrinsics and extrinsics).
|
* @brief It is useful when the align target stream dose not started (without any frame to get intrinsics and extrinsics).
|
||||||
*
|
*
|
||||||
* @param filter A filter object.
|
* @param filter A filter object.
|
||||||
* @param align_to_stream_profile The align target stream profile.
|
* @param align_to_stream_profile The align target stream profile.
|
||||||
|
|||||||
@@ -1010,6 +1010,16 @@ typedef enum {
|
|||||||
} OBHoleFillingMode,
|
} OBHoleFillingMode,
|
||||||
ob_hole_filling_mode;
|
ob_hole_filling_mode;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint8_t radius; // window_size
|
||||||
|
} OBSpatialFastFilterParams, ob_spatial_fast_filter_params;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint8_t radius; // window_size
|
||||||
|
uint8_t magnitude; // magnitude
|
||||||
|
uint16_t disp_diff; // smooth_delta
|
||||||
|
} OBSpatialModerateFilterParams, ob_spatial_moderate_filter_params;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t magnitude; // magnitude
|
uint8_t magnitude; // magnitude
|
||||||
float alpha; // smooth_alpha
|
float alpha; // smooth_alpha
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class DevicePresetList;
|
|||||||
class OBDepthWorkModeList;
|
class OBDepthWorkModeList;
|
||||||
class CameraParamList;
|
class CameraParamList;
|
||||||
class DeviceFrameInterleaveList;
|
class DeviceFrameInterleaveList;
|
||||||
class PresetResolutionConfigeList;
|
class PresetResolutionConfigList;
|
||||||
|
|
||||||
class Device {
|
class Device {
|
||||||
public:
|
public:
|
||||||
@@ -824,15 +824,15 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get available frame interleave list
|
* @brief Get the available preset resolution config list
|
||||||
*
|
*
|
||||||
* @return DeviceFrameInterleaveList return the available frame interleave list.
|
* @return PresetResolutionConfigList return the available preset resolution config list.
|
||||||
*/
|
*/
|
||||||
std::shared_ptr<PresetResolutionConfigeList> getAvailablePresetResolutionConfigeList() const {
|
std::shared_ptr<PresetResolutionConfigList> getAvailablePresetResolutionConfigList() const {
|
||||||
ob_error *error = nullptr;
|
ob_error *error = nullptr;
|
||||||
auto list = ob_device_get_available_preset_resolution_config_list(impl_, &error);
|
auto list = ob_device_get_available_preset_resolution_config_list(impl_, &error);
|
||||||
Error::handle(&error);
|
Error::handle(&error);
|
||||||
return std::make_shared<PresetResolutionConfigeList>(list);
|
return std::make_shared<PresetResolutionConfigList>(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -1516,15 +1516,15 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Class representing a list of device Frame Interleave
|
* @brief Class representing a list of preset resolution config list
|
||||||
*/
|
*/
|
||||||
class PresetResolutionConfigeList {
|
class PresetResolutionConfigList {
|
||||||
private:
|
private:
|
||||||
ob_preset_resolution_config_list_t *impl_ = nullptr;
|
ob_preset_resolution_config_list_t *impl_ = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PresetResolutionConfigeList(ob_preset_resolution_config_list_t *impl) : impl_(impl) {}
|
explicit PresetResolutionConfigList(ob_preset_resolution_config_list_t *impl) : impl_(impl) {}
|
||||||
~PresetResolutionConfigeList() noexcept {
|
~PresetResolutionConfigList() noexcept {
|
||||||
ob_error *error = nullptr;
|
ob_error *error = nullptr;
|
||||||
ob_delete_preset_resolution_config_list(impl_, &error);
|
ob_delete_preset_resolution_config_list(impl_, &error);
|
||||||
Error::handle(&error, false);
|
Error::handle(&error, false);
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @file Filter.hpp
|
* @file Filter.hpp
|
||||||
* @brief This file contains the Filter class, which is the processing unit of the SDK that can perform point cloud generation, format conversion, and other
|
* @brief This file contains the Filter class, which is the processing unit of the SDK that can
|
||||||
* functions.
|
* perform point cloud generation, format conversion, and other functions.
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@@ -34,30 +34,36 @@ typedef std::function<void(std::shared_ptr<Frame>)> FilterCallback;
|
|||||||
/**
|
/**
|
||||||
* @brief Get the type of a PropertyRange member
|
* @brief Get the type of a PropertyRange member
|
||||||
*/
|
*/
|
||||||
template <typename T> struct RangeTraits {
|
template <typename T>
|
||||||
|
struct RangeTraits {
|
||||||
using valueType = void;
|
using valueType = void;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <> struct RangeTraits<OBUint8PropertyRange> {
|
template <>
|
||||||
|
struct RangeTraits<OBUint8PropertyRange> {
|
||||||
using valueType = uint8_t;
|
using valueType = uint8_t;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <> struct RangeTraits<OBUint16PropertyRange> {
|
template <>
|
||||||
|
struct RangeTraits<OBUint16PropertyRange> {
|
||||||
using valueType = uint16_t;
|
using valueType = uint16_t;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <> struct RangeTraits<OBIntPropertyRange> {
|
template <>
|
||||||
|
struct RangeTraits<OBIntPropertyRange> {
|
||||||
using valueType = uint32_t;
|
using valueType = uint32_t;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <> struct RangeTraits<OBFloatPropertyRange> {
|
template <>
|
||||||
|
struct RangeTraits<OBFloatPropertyRange> {
|
||||||
using valueType = float;
|
using valueType = float;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get T Property Range
|
* @brief Get T Property Range
|
||||||
*/
|
*/
|
||||||
template <typename T> T getPropertyRange(const OBFilterConfigSchemaItem &item, const double cur) {
|
template <typename T>
|
||||||
|
T getPropertyRange(const OBFilterConfigSchemaItem &item, const double cur) {
|
||||||
// If T type is illegal, T will be void
|
// If T type is illegal, T will be void
|
||||||
using valueType = typename RangeTraits<T>::valueType;
|
using valueType = typename RangeTraits<T>::valueType;
|
||||||
T range{};
|
T range{};
|
||||||
@@ -74,13 +80,13 @@ template <typename T> T getPropertyRange(const OBFilterConfigSchemaItem &item, c
|
|||||||
* @brief The Filter class is the base class for all filters in the SDK.
|
* @brief The Filter class is the base class for all filters in the SDK.
|
||||||
*/
|
*/
|
||||||
class Filter : public std::enable_shared_from_this<Filter> {
|
class Filter : public std::enable_shared_from_this<Filter> {
|
||||||
protected:
|
protected:
|
||||||
ob_filter *impl_ = nullptr;
|
ob_filter *impl_ = nullptr;
|
||||||
std::string name_;
|
std::string name_;
|
||||||
FilterCallback callback_;
|
FilterCallback callback_;
|
||||||
std::vector<OBFilterConfigSchemaItem> configSchemaVec_;
|
std::vector<OBFilterConfigSchemaItem> configSchemaVec_;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief Default constructor with nullptr impl, used for derived classes only.
|
* @brief Default constructor with nullptr impl, used for derived classes only.
|
||||||
*/
|
*/
|
||||||
@@ -98,7 +104,7 @@ protected:
|
|||||||
auto count = ob_filter_config_schema_list_get_count(configSchemaList, &error);
|
auto count = ob_filter_config_schema_list_get_count(configSchemaList, &error);
|
||||||
Error::handle(&error);
|
Error::handle(&error);
|
||||||
|
|
||||||
for(uint32_t i = 0; i < count; i++) {
|
for (uint32_t i = 0; i < count; i++) {
|
||||||
auto item = ob_filter_config_schema_list_get_item(configSchemaList, i, &error);
|
auto item = ob_filter_config_schema_list_get_item(configSchemaList, i, &error);
|
||||||
Error::handle(&error);
|
Error::handle(&error);
|
||||||
configSchemaVec_.emplace_back(item);
|
configSchemaVec_.emplace_back(item);
|
||||||
@@ -108,13 +114,11 @@ protected:
|
|||||||
Error::handle(&error);
|
Error::handle(&error);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Filter(ob_filter *impl) {
|
explicit Filter(ob_filter *impl) { init(impl); }
|
||||||
init(impl);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~Filter() noexcept {
|
virtual ~Filter() noexcept {
|
||||||
if(impl_ != nullptr) {
|
if (impl_ != nullptr) {
|
||||||
ob_error *error = nullptr;
|
ob_error *error = nullptr;
|
||||||
ob_delete_filter(impl_, &error);
|
ob_delete_filter(impl_, &error);
|
||||||
Error::handle(&error, false);
|
Error::handle(&error, false);
|
||||||
@@ -126,22 +130,18 @@ public:
|
|||||||
*
|
*
|
||||||
* @return ob_filter* The Impl object of the filter.
|
* @return ob_filter* The Impl object of the filter.
|
||||||
*/
|
*/
|
||||||
ob_filter *getImpl() const {
|
ob_filter *getImpl() const { return impl_; }
|
||||||
return impl_;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the type of filter.
|
* @brief Get the type of filter.
|
||||||
*
|
*
|
||||||
* @return string The type of filte.
|
* @return string The type of filte.
|
||||||
*/
|
*/
|
||||||
virtual const std::string &getName() const {
|
virtual const std::string &getName() const { return name_; }
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reset the filter, freeing the internal cache, stopping the processing thread, and clearing the pending buffer frame when asynchronous processing
|
* @brief Reset the filter, freeing the internal cache, stopping the processing thread, and
|
||||||
* is used.
|
* clearing the pending buffer frame when asynchronous processing is used.
|
||||||
*/
|
*/
|
||||||
virtual void reset() const {
|
virtual void reset() const {
|
||||||
ob_error *error = nullptr;
|
ob_error *error = nullptr;
|
||||||
@@ -178,7 +178,7 @@ public:
|
|||||||
ob_error *error = nullptr;
|
ob_error *error = nullptr;
|
||||||
auto result = ob_filter_process(impl_, frame->getImpl(), &error);
|
auto result = ob_filter_process(impl_, frame->getImpl(), &error);
|
||||||
Error::handle(&error);
|
Error::handle(&error);
|
||||||
if(!result) {
|
if (!result) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return std::make_shared<Frame>(result);
|
return std::make_shared<Frame>(result);
|
||||||
@@ -209,8 +209,10 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get config schema of the filter
|
* @brief Get config schema of the filter
|
||||||
* @brief The returned string is a csv format string representing the configuration schema of the filter. The format of the string is:
|
* @brief The returned string is a csv format string representing the configuration schema of the
|
||||||
* <parameter_name>, <parameter_type: "int", "float", "bool">, <minimum_value>, <maximum_value>, <value_step>, <default_value>, <parameter_description>
|
* filter. The format of the string is: <parameter_name>, <parameter_type: "int", "float",
|
||||||
|
* "bool">, <minimum_value>, <maximum_value>, <value_step>, <default_value>,
|
||||||
|
* <parameter_description>
|
||||||
*
|
*
|
||||||
* @return std::string The config schema of the filter.
|
* @return std::string The config schema of the filter.
|
||||||
*/
|
*/
|
||||||
@@ -223,7 +225,8 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the Config Schema Vec object
|
* @brief Get the Config Schema Vec object
|
||||||
* @brief The returned vector contains the config schema items. Each item in the vector is an @ref OBFilterConfigSchemaItem object.
|
* @brief The returned vector contains the config schema items. Each item in the vector is an @ref
|
||||||
|
* OBFilterConfigSchemaItem object.
|
||||||
*
|
*
|
||||||
* @return std::vector<OBFilterConfigSchemaItem> The vector of the filter config schema.
|
* @return std::vector<OBFilterConfigSchemaItem> The vector of the filter config schema.
|
||||||
*/
|
*/
|
||||||
@@ -234,8 +237,9 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @brief Set the filter config value by name.
|
* @brief Set the filter config value by name.
|
||||||
*
|
*
|
||||||
* @attention The pass into value type is double, witch will be cast to the actual type inside the filter. The actual type can be queried by the filter
|
* @attention The pass into value type is double, witch will be cast to the actual type inside the
|
||||||
* config schema returned by @ref getConfigSchemaVec.
|
* filter. The actual type can be queried by the filter config schema returned by @ref
|
||||||
|
* getConfigSchemaVec.
|
||||||
*
|
*
|
||||||
* @param configName The name of the config.
|
* @param configName The name of the config.
|
||||||
* @param value The value of the config.
|
* @param value The value of the config.
|
||||||
@@ -249,7 +253,8 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @brief Get the Config Value object by name.
|
* @brief Get the Config Value object by name.
|
||||||
*
|
*
|
||||||
* @attention The returned value type has been casted to double inside the filter. The actual type can be queried by the filter config schema returned by
|
* @attention The returned value type has been casted to double inside the filter. The actual type
|
||||||
|
* can be queried by the filter config schema returned by
|
||||||
* @ref getConfigSchemaVec.
|
* @ref getConfigSchemaVec.
|
||||||
*
|
*
|
||||||
* @param configName The name of the config.
|
* @param configName The name of the config.
|
||||||
@@ -262,17 +267,15 @@ public:
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void filterCallback(ob_frame *frame, void *userData) {
|
static void filterCallback(ob_frame *frame, void *userData) {
|
||||||
auto filter = static_cast<Filter *>(userData);
|
auto filter = static_cast<Filter *>(userData);
|
||||||
filter->callback_(std::make_shared<Frame>(frame));
|
filter->callback_(std::make_shared<Frame>(frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||||
virtual const char *type() {
|
virtual const char *type() { return getName().c_str(); }
|
||||||
return getName().c_str();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Check if the runtime type of the filter object is compatible with a given type.
|
* @brief Check if the runtime type of the filter object is compatible with a given type.
|
||||||
@@ -280,10 +283,12 @@ public:
|
|||||||
* @tparam T The given type.
|
* @tparam T The given type.
|
||||||
* @return bool The result.
|
* @return bool The result.
|
||||||
*/
|
*/
|
||||||
template <typename T> bool is();
|
template <typename T>
|
||||||
|
bool is();
|
||||||
|
|
||||||
template <typename T> std::shared_ptr<T> as() {
|
template <typename T>
|
||||||
if(!is<T>()) {
|
std::shared_ptr<T> as() {
|
||||||
|
if (!is<T>()) {
|
||||||
throw std::runtime_error("unsupported operation, object's type is not require type");
|
throw std::runtime_error("unsupported operation, object's type is not require type");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,7 +300,7 @@ public:
|
|||||||
* @brief A factory class for creating filters.
|
* @brief A factory class for creating filters.
|
||||||
*/
|
*/
|
||||||
class FilterFactory {
|
class FilterFactory {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Create a filter by name.
|
* @brief Create a filter by name.
|
||||||
*/
|
*/
|
||||||
@@ -308,12 +313,14 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Create a private filter by name and activation key.
|
* @brief Create a private filter by name and activation key.
|
||||||
* @brief Some private filters require an activation key to be activated, its depends on the vendor of the filter.
|
* @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 name The name of the filter.
|
||||||
* @param activationKey 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) {
|
static std::shared_ptr<Filter> createPrivateFilter(const std::string &name,
|
||||||
|
const std::string &activationKey) {
|
||||||
ob_error *error = nullptr;
|
ob_error *error = nullptr;
|
||||||
auto impl = ob_create_private_filter(name.c_str(), activationKey.c_str(), &error);
|
auto impl = ob_create_private_filter(name.c_str(), activationKey.c_str(), &error);
|
||||||
Error::handle(&error);
|
Error::handle(&error);
|
||||||
@@ -339,7 +346,7 @@ public:
|
|||||||
* @brief The PointCloudFilter class is a subclass of Filter that generates point clouds.
|
* @brief The PointCloudFilter class is a subclass of Filter that generates point clouds.
|
||||||
*/
|
*/
|
||||||
class PointCloudFilter : public Filter {
|
class PointCloudFilter : public Filter {
|
||||||
public:
|
public:
|
||||||
PointCloudFilter() {
|
PointCloudFilter() {
|
||||||
ob_error *error = nullptr;
|
ob_error *error = nullptr;
|
||||||
auto impl = ob_create_filter("PointCloudFilter", &error);
|
auto impl = ob_create_filter("PointCloudFilter", &error);
|
||||||
@@ -361,26 +368,24 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @brief Set the point cloud coordinate data zoom factor.
|
* @brief Set the point cloud coordinate data zoom factor.
|
||||||
*
|
*
|
||||||
* @brief Calling this function to set the scale will change the point coordinate scaling factor of the output point cloud frame, The point coordinate
|
* @brief Calling this function to set the scale will change the point coordinate scaling factor
|
||||||
* scaling factor for the output point cloud frame can be obtained via @ref PointsFrame::getCoordinateValueScale function.
|
* of the output point cloud frame, The point coordinate scaling factor for the output point cloud
|
||||||
|
* frame can be obtained via @ref PointsFrame::getCoordinateValueScale function.
|
||||||
*
|
*
|
||||||
* @param factor The scale factor.
|
* @param factor The scale factor.
|
||||||
*/
|
*/
|
||||||
void setCoordinateDataScaled(float factor) {
|
void setCoordinateDataScaled(float factor) { setConfigValue("coordinateDataScale", factor); }
|
||||||
setConfigValue("coordinateDataScale", factor);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set point cloud color data normalization.
|
* @brief Set point cloud color data normalization.
|
||||||
* @brief If normalization is required, the output point cloud frame's color data will be normalized to the range [0, 1].
|
* @brief If normalization is required, the output point cloud frame's color data will be
|
||||||
|
* normalized to the range [0, 1].
|
||||||
*
|
*
|
||||||
* @attention This function only works for when create point format is set to OB_FORMAT_RGB_POINT.
|
* @attention This function only works for when create point format is set to OB_FORMAT_RGB_POINT.
|
||||||
*
|
*
|
||||||
* @param state Whether normalization is required.
|
* @param state Whether normalization is required.
|
||||||
*/
|
*/
|
||||||
void setColorDataNormalization(bool state) {
|
void setColorDataNormalization(bool state) { setConfigValue("colorDataNormalization", state); }
|
||||||
setConfigValue("colorDataNormalization", state);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the point cloud coordinate system.
|
* @brief Set the point cloud coordinate system.
|
||||||
@@ -391,27 +396,23 @@ public:
|
|||||||
setConfigValue("coordinateSystemType", static_cast<double>(type));
|
setConfigValue("coordinateSystemType", static_cast<double>(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||||
void setPositionDataScaled(float scale) {
|
void setPositionDataScaled(float scale) { setCoordinateDataScaled(scale); }
|
||||||
setCoordinateDataScaled(scale);
|
|
||||||
}
|
|
||||||
|
|
||||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||||
void setFrameAlignState(bool state) {
|
void setFrameAlignState(bool state) {
|
||||||
(void)state; // to complie
|
(void)state; // to complie
|
||||||
}
|
}
|
||||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||||
void setCameraParam(OBCameraParam param) {
|
void setCameraParam(OBCameraParam param) { (void)param; }
|
||||||
(void)param;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Align for depth to other or other to depth.
|
* @brief Align for depth to other or other to depth.
|
||||||
*/
|
*/
|
||||||
class Align : public Filter {
|
class Align : public Filter {
|
||||||
public:
|
public:
|
||||||
Align(OBStreamType alignToStreamType) {
|
Align(OBStreamType alignToStreamType) {
|
||||||
ob_error *error = nullptr;
|
ob_error *error = nullptr;
|
||||||
auto impl = ob_create_filter("Align", &error);
|
auto impl = ob_create_filter("Align", &error);
|
||||||
@@ -429,21 +430,20 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets whether the output frame resolution should match the target resolution.
|
* @brief Sets whether the output frame resolution should match the target resolution.
|
||||||
* When enabled, the output frame resolution will be adjusted to match (same as) the target resolution.
|
* When enabled, the output frame resolution will be adjusted to match (same as) the target
|
||||||
* When disabled, the output frame resolution will match the original resolution while maintaining
|
* resolution. When disabled, the output frame resolution will match the original resolution while
|
||||||
* the aspect ratio of the target resolution.
|
* maintaining the aspect ratio of the target resolution.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param state If true, output frame resolution will match the target resolution; otherwise, it will
|
* @param state If true, output frame resolution will match the target resolution; otherwise, it
|
||||||
* maintain the original resolution with the target's aspect ratio.
|
* will maintain the original resolution with the target's aspect ratio.
|
||||||
*/
|
*/
|
||||||
void setMatchTargetResolution(bool state) {
|
void setMatchTargetResolution(bool state) { setConfigValue("MatchTargetRes", state); }
|
||||||
setConfigValue("MatchTargetRes", state);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the Align To Stream Profile
|
* @brief Set the Align To Stream Profile
|
||||||
* @brief It is useful when the align target stream dose not started (without any frame to get intrinsics and extrinsics).
|
* @brief It is useful when the align target stream dose not started (without any frame to get
|
||||||
|
* intrinsics and extrinsics).
|
||||||
*
|
*
|
||||||
* @param profile The Align To Stream Profile.
|
* @param profile The Align To Stream Profile.
|
||||||
*/
|
*/
|
||||||
@@ -458,7 +458,7 @@ public:
|
|||||||
* @brief The FormatConvertFilter class is a subclass of Filter that performs format conversion.
|
* @brief The FormatConvertFilter class is a subclass of Filter that performs format conversion.
|
||||||
*/
|
*/
|
||||||
class FormatConvertFilter : public Filter {
|
class FormatConvertFilter : public Filter {
|
||||||
public:
|
public:
|
||||||
FormatConvertFilter() {
|
FormatConvertFilter() {
|
||||||
ob_error *error = nullptr;
|
ob_error *error = nullptr;
|
||||||
auto impl = ob_create_filter("FormatConverter", &error);
|
auto impl = ob_create_filter("FormatConverter", &error);
|
||||||
@@ -484,7 +484,7 @@ public:
|
|||||||
* different sub-preset sequence ids.
|
* different sub-preset sequence ids.
|
||||||
*/
|
*/
|
||||||
class HdrMerge : public Filter {
|
class HdrMerge : public Filter {
|
||||||
public:
|
public:
|
||||||
HdrMerge() {
|
HdrMerge() {
|
||||||
ob_error *error = nullptr;
|
ob_error *error = nullptr;
|
||||||
auto impl = ob_create_filter("HDRMerge", &error);
|
auto impl = ob_create_filter("HDRMerge", &error);
|
||||||
@@ -499,23 +499,24 @@ public:
|
|||||||
* @brief Create SequenceIdFilter processing block.
|
* @brief Create SequenceIdFilter processing block.
|
||||||
*/
|
*/
|
||||||
class SequenceIdFilter : public Filter {
|
class SequenceIdFilter : public Filter {
|
||||||
private:
|
private:
|
||||||
std::map<float, std::string> sequenceIdList_{ { 0.f, "all" }, { 1.f, "1" } };
|
std::map<float, std::string> sequenceIdList_{{0.f, "all"}, {1.f, "1"}};
|
||||||
OBSequenceIdItem *outputSequenceIdList_ = nullptr;
|
OBSequenceIdItem *outputSequenceIdList_ = nullptr;
|
||||||
|
|
||||||
void initSequenceIdList() {
|
void initSequenceIdList() {
|
||||||
outputSequenceIdList_ = new OBSequenceIdItem[sequenceIdList_.size()];
|
outputSequenceIdList_ = new OBSequenceIdItem[sequenceIdList_.size()];
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(const auto &pair: sequenceIdList_) {
|
for (const auto &pair : sequenceIdList_) {
|
||||||
outputSequenceIdList_[i].sequenceSelectId = static_cast<int>(pair.first);
|
outputSequenceIdList_[i].sequenceSelectId = static_cast<int>(pair.first);
|
||||||
strncpy(outputSequenceIdList_[i].name, pair.second.c_str(), sizeof(outputSequenceIdList_[i].name) - 1);
|
strncpy(outputSequenceIdList_[i].name, pair.second.c_str(),
|
||||||
|
sizeof(outputSequenceIdList_[i].name) - 1);
|
||||||
outputSequenceIdList_[i].name[sizeof(outputSequenceIdList_[i].name) - 1] = '\0';
|
outputSequenceIdList_[i].name[sizeof(outputSequenceIdList_[i].name) - 1] = '\0';
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SequenceIdFilter() {
|
SequenceIdFilter() {
|
||||||
ob_error *error = nullptr;
|
ob_error *error = nullptr;
|
||||||
auto impl = ob_create_filter("SequenceIdFilter", &error);
|
auto impl = ob_create_filter("SequenceIdFilter", &error);
|
||||||
@@ -525,7 +526,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual ~SequenceIdFilter() noexcept override {
|
virtual ~SequenceIdFilter() noexcept override {
|
||||||
if(outputSequenceIdList_) {
|
if (outputSequenceIdList_) {
|
||||||
delete[] outputSequenceIdList_;
|
delete[] outputSequenceIdList_;
|
||||||
outputSequenceIdList_ = nullptr;
|
outputSequenceIdList_ = nullptr;
|
||||||
}
|
}
|
||||||
@@ -545,29 +546,23 @@ public:
|
|||||||
*
|
*
|
||||||
* @return sequence id to pass the filter.
|
* @return sequence id to pass the filter.
|
||||||
*/
|
*/
|
||||||
int getSelectSequenceId() {
|
int getSelectSequenceId() { return static_cast<int>(getConfigValue("sequenceid")); }
|
||||||
return static_cast<int>(getConfigValue("sequenceid"));
|
|
||||||
}
|
|
||||||
|
|
||||||
OBSequenceIdItem *getSequenceIdList() {
|
OBSequenceIdItem *getSequenceIdList() { return outputSequenceIdList_; }
|
||||||
return outputSequenceIdList_;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the sequenceId list size.
|
* @brief Get the sequenceId list size.
|
||||||
*
|
*
|
||||||
* @return the size of sequenceId list.
|
* @return the size of sequenceId list.
|
||||||
*/
|
*/
|
||||||
int getSequenceIdListSize() {
|
int getSequenceIdListSize() { return static_cast<int>(sequenceIdList_.size()); }
|
||||||
return static_cast<int>(sequenceIdList_.size());
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Decimation filter, reducing complexity by subsampling depth maps and losing depth details.
|
* @brief Decimation filter, reducing complexity by subsampling depth maps and losing depth details.
|
||||||
*/
|
*/
|
||||||
class DecimationFilter : public Filter {
|
class DecimationFilter : public Filter {
|
||||||
public:
|
public:
|
||||||
DecimationFilter() {
|
DecimationFilter() {
|
||||||
ob_error *error = nullptr;
|
ob_error *error = nullptr;
|
||||||
auto impl = ob_create_filter("DecimationFilter", &error);
|
auto impl = ob_create_filter("DecimationFilter", &error);
|
||||||
@@ -582,23 +577,19 @@ public:
|
|||||||
*
|
*
|
||||||
* @param value The decimation filter scale value.
|
* @param value The decimation filter scale value.
|
||||||
*/
|
*/
|
||||||
void setScaleValue(uint8_t value) {
|
void setScaleValue(uint8_t value) { setConfigValue("decimate", static_cast<double>(value)); }
|
||||||
setConfigValue("decimate", static_cast<double>(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the decimation filter scale value.
|
* @brief Get the decimation filter scale value.
|
||||||
*/
|
*/
|
||||||
uint8_t getScaleValue() {
|
uint8_t getScaleValue() { return static_cast<uint8_t>(getConfigValue("decimate")); }
|
||||||
return static_cast<uint8_t>(getConfigValue("decimate"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the property range of the decimation filter scale value.
|
* @brief Get the property range of the decimation filter scale value.
|
||||||
*/
|
*/
|
||||||
OBUint8PropertyRange getScaleRange() {
|
OBUint8PropertyRange getScaleRange() {
|
||||||
OBUint8PropertyRange scaleRange{};
|
OBUint8PropertyRange scaleRange{};
|
||||||
if(configSchemaVec_.size() != 0) {
|
if (configSchemaVec_.size() != 0) {
|
||||||
const auto &item = configSchemaVec_[0];
|
const auto &item = configSchemaVec_[0];
|
||||||
scaleRange = getPropertyRange<OBUint8PropertyRange>(item, getConfigValue("decimate"));
|
scaleRange = getPropertyRange<OBUint8PropertyRange>(item, getConfigValue("decimate"));
|
||||||
}
|
}
|
||||||
@@ -611,7 +602,7 @@ public:
|
|||||||
* By controlling min and max options on the block
|
* By controlling min and max options on the block
|
||||||
*/
|
*/
|
||||||
class ThresholdFilter : public Filter {
|
class ThresholdFilter : public Filter {
|
||||||
public:
|
public:
|
||||||
ThresholdFilter() {
|
ThresholdFilter() {
|
||||||
ob_error *error = nullptr;
|
ob_error *error = nullptr;
|
||||||
auto impl = ob_create_filter("ThresholdFilter", &error);
|
auto impl = ob_create_filter("ThresholdFilter", &error);
|
||||||
@@ -629,8 +620,8 @@ public:
|
|||||||
OBIntPropertyRange getMinRange() {
|
OBIntPropertyRange getMinRange() {
|
||||||
OBIntPropertyRange range{};
|
OBIntPropertyRange range{};
|
||||||
const auto &schemaVec = getConfigSchemaVec();
|
const auto &schemaVec = getConfigSchemaVec();
|
||||||
for(const auto &item: schemaVec) {
|
for (const auto &item : schemaVec) {
|
||||||
if(strcmp(item.name, "min") == 0) {
|
if (strcmp(item.name, "min") == 0) {
|
||||||
range = getPropertyRange<OBIntPropertyRange>(item, getConfigValue("min"));
|
range = getPropertyRange<OBIntPropertyRange>(item, getConfigValue("min"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -646,8 +637,8 @@ public:
|
|||||||
OBIntPropertyRange getMaxRange() {
|
OBIntPropertyRange getMaxRange() {
|
||||||
OBIntPropertyRange range{};
|
OBIntPropertyRange range{};
|
||||||
const auto &schemaVec = getConfigSchemaVec();
|
const auto &schemaVec = getConfigSchemaVec();
|
||||||
for(const auto &item: schemaVec) {
|
for (const auto &item : schemaVec) {
|
||||||
if(strcmp(item.name, "max") == 0) {
|
if (strcmp(item.name, "max") == 0) {
|
||||||
range = getPropertyRange<OBIntPropertyRange>(item, getConfigValue("max"));
|
range = getPropertyRange<OBIntPropertyRange>(item, getConfigValue("max"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -659,7 +650,7 @@ public:
|
|||||||
* @brief Set the threshold filter max and min range.
|
* @brief Set the threshold filter max and min range.
|
||||||
*/
|
*/
|
||||||
bool setValueRange(uint16_t min, uint16_t max) {
|
bool setValueRange(uint16_t min, uint16_t max) {
|
||||||
if(min >= max) {
|
if (min >= max) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
setConfigValue("min", min);
|
setConfigValue("min", min);
|
||||||
@@ -669,12 +660,12 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Spatial advanced filte smooths the image by calculating frame with alpha and delta settings
|
* @brief Spatial advanced filte smooths the image by calculating frame with alpha and delta
|
||||||
* alpha defines the weight of the current pixel for smoothing,
|
* settings alpha defines the weight of the current pixel for smoothing, delta defines the depth
|
||||||
* delta defines the depth gradient below which the smoothing will occur as number of depth levels.
|
* gradient below which the smoothing will occur as number of depth levels.
|
||||||
*/
|
*/
|
||||||
class SpatialAdvancedFilter : public Filter {
|
class SpatialAdvancedFilter : public Filter {
|
||||||
public:
|
public:
|
||||||
SpatialAdvancedFilter(const std::string &activationKey = "") {
|
SpatialAdvancedFilter(const std::string &activationKey = "") {
|
||||||
ob_error *error = nullptr;
|
ob_error *error = nullptr;
|
||||||
auto impl = ob_create_private_filter("SpatialAdvancedFilter", activationKey.c_str(), &error);
|
auto impl = ob_create_private_filter("SpatialAdvancedFilter", activationKey.c_str(), &error);
|
||||||
@@ -692,8 +683,8 @@ public:
|
|||||||
OBFloatPropertyRange getAlphaRange() {
|
OBFloatPropertyRange getAlphaRange() {
|
||||||
OBFloatPropertyRange range{};
|
OBFloatPropertyRange range{};
|
||||||
const auto &schemaVec = getConfigSchemaVec();
|
const auto &schemaVec = getConfigSchemaVec();
|
||||||
for(const auto &item: schemaVec) {
|
for (const auto &item : schemaVec) {
|
||||||
if(strcmp(item.name, "alpha") == 0) {
|
if (strcmp(item.name, "alpha") == 0) {
|
||||||
range = getPropertyRange<OBFloatPropertyRange>(item, getConfigValue("alpha"));
|
range = getPropertyRange<OBFloatPropertyRange>(item, getConfigValue("alpha"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -709,8 +700,8 @@ public:
|
|||||||
OBUint16PropertyRange getDispDiffRange() {
|
OBUint16PropertyRange getDispDiffRange() {
|
||||||
OBUint16PropertyRange range{};
|
OBUint16PropertyRange range{};
|
||||||
const auto &schemaVec = getConfigSchemaVec();
|
const auto &schemaVec = getConfigSchemaVec();
|
||||||
for(const auto &item: schemaVec) {
|
for (const auto &item : schemaVec) {
|
||||||
if(strcmp(item.name, "disp_diff") == 0) {
|
if (strcmp(item.name, "disp_diff") == 0) {
|
||||||
range = getPropertyRange<OBUint16PropertyRange>(item, getConfigValue("disp_diff"));
|
range = getPropertyRange<OBUint16PropertyRange>(item, getConfigValue("disp_diff"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -726,8 +717,8 @@ public:
|
|||||||
OBUint16PropertyRange getRadiusRange() {
|
OBUint16PropertyRange getRadiusRange() {
|
||||||
OBUint16PropertyRange range{};
|
OBUint16PropertyRange range{};
|
||||||
const auto &schemaVec = getConfigSchemaVec();
|
const auto &schemaVec = getConfigSchemaVec();
|
||||||
for(const auto &item: schemaVec) {
|
for (const auto &item : schemaVec) {
|
||||||
if(strcmp(item.name, "radius") == 0) {
|
if (strcmp(item.name, "radius") == 0) {
|
||||||
range = getPropertyRange<OBUint16PropertyRange>(item, getConfigValue("radius"));
|
range = getPropertyRange<OBUint16PropertyRange>(item, getConfigValue("radius"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -743,8 +734,8 @@ public:
|
|||||||
OBIntPropertyRange getMagnitudeRange() {
|
OBIntPropertyRange getMagnitudeRange() {
|
||||||
OBIntPropertyRange range{};
|
OBIntPropertyRange range{};
|
||||||
const auto &schemaVec = getConfigSchemaVec();
|
const auto &schemaVec = getConfigSchemaVec();
|
||||||
for(const auto &item: schemaVec) {
|
for (const auto &item : schemaVec) {
|
||||||
if(strcmp(item.name, "magnitude") == 0) {
|
if (strcmp(item.name, "magnitude") == 0) {
|
||||||
range = getPropertyRange<OBIntPropertyRange>(item, getConfigValue("magnitude"));
|
range = getPropertyRange<OBIntPropertyRange>(item, getConfigValue("magnitude"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -779,11 +770,155 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The Spatial Fast Filter utilizes an enhanced median smoothing algorithm,
|
||||||
|
* designed to significantly reduce CPU usage and optimize processing efficiency.
|
||||||
|
*/
|
||||||
|
class SpatialFastFilter : public Filter {
|
||||||
|
public:
|
||||||
|
SpatialFastFilter(const std::string &activationKey = "") {
|
||||||
|
ob_error *error = nullptr;
|
||||||
|
auto impl = ob_create_private_filter("SpatialFastFilter", activationKey.c_str(), &error);
|
||||||
|
Error::handle(&error);
|
||||||
|
init(impl);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~SpatialFastFilter() noexcept override = default;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the spatial fast filter radius range.
|
||||||
|
*
|
||||||
|
* @return OBIntPropertyRange the radius value of property range.
|
||||||
|
*/
|
||||||
|
OBIntPropertyRange getRadiusRange() {
|
||||||
|
OBIntPropertyRange range{};
|
||||||
|
const auto &schemaVec = getConfigSchemaVec();
|
||||||
|
for (const auto &item : schemaVec) {
|
||||||
|
if (strcmp(item.name, "radius") == 0) {
|
||||||
|
range = getPropertyRange<OBIntPropertyRange>(item, getConfigValue("radius"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the spatial fast filter params.
|
||||||
|
*
|
||||||
|
* @return OBSpatialFastFilterParams
|
||||||
|
*/
|
||||||
|
OBSpatialFastFilterParams getFilterParams() {
|
||||||
|
OBSpatialFastFilterParams params{};
|
||||||
|
params.radius = static_cast<uint8_t>(getConfigValue("radius"));
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the spatial fast filter params.
|
||||||
|
*
|
||||||
|
* @param params OBSpatialFastFilterParams.
|
||||||
|
*/
|
||||||
|
void setFilterParams(OBSpatialFastFilterParams params) {
|
||||||
|
setConfigValue("radius", params.radius);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The Spatial Moderate Filter utilizes an optimized average smoothing algorithm,
|
||||||
|
* to achieve a balance between processing speed and the quality of smoothing achieved.
|
||||||
|
*/
|
||||||
|
class SpatialModerateFilter : public Filter {
|
||||||
|
public:
|
||||||
|
SpatialModerateFilter(const std::string &activationKey = "") {
|
||||||
|
ob_error *error = nullptr;
|
||||||
|
auto impl = ob_create_private_filter("SpatialModerateFilter", activationKey.c_str(), &error);
|
||||||
|
Error::handle(&error);
|
||||||
|
init(impl);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~SpatialModerateFilter() noexcept override = default;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the spatial moderate filter magnitude range.
|
||||||
|
*
|
||||||
|
* @return OBIntPropertyRange the magnitude value of property range.
|
||||||
|
*/
|
||||||
|
OBIntPropertyRange getMagnitudeRange() {
|
||||||
|
OBIntPropertyRange range{};
|
||||||
|
const auto &schemaVec = getConfigSchemaVec();
|
||||||
|
for (const auto &item : schemaVec) {
|
||||||
|
if (strcmp(item.name, "magnitude") == 0) {
|
||||||
|
range = getPropertyRange<OBIntPropertyRange>(item, getConfigValue("magnitude"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the spatial moderate filter radius range.
|
||||||
|
*
|
||||||
|
* @return OBIntPropertyRange the radius value of property range.
|
||||||
|
*/
|
||||||
|
OBIntPropertyRange getRadiusRange() {
|
||||||
|
OBIntPropertyRange range{};
|
||||||
|
const auto &schemaVec = getConfigSchemaVec();
|
||||||
|
for (const auto &item : schemaVec) {
|
||||||
|
if (strcmp(item.name, "radius") == 0) {
|
||||||
|
range = getPropertyRange<OBIntPropertyRange>(item, getConfigValue("radius"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the spatial moderate filter disp diff range.
|
||||||
|
*
|
||||||
|
* @return OBIntPropertyRange the disp diff value of property range.
|
||||||
|
*/
|
||||||
|
OBIntPropertyRange getDispDiffRange() {
|
||||||
|
OBIntPropertyRange range{};
|
||||||
|
const auto &schemaVec = getConfigSchemaVec();
|
||||||
|
for (const auto &item : schemaVec) {
|
||||||
|
if (strcmp(item.name, "disp_diff") == 0) {
|
||||||
|
range = getPropertyRange<OBIntPropertyRange>(item, getConfigValue("disp_diff"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the spatial moderate filter params.
|
||||||
|
*
|
||||||
|
* @return OBSpatialModerateFilterParams
|
||||||
|
*/
|
||||||
|
OBSpatialModerateFilterParams getFilterParams() {
|
||||||
|
OBSpatialModerateFilterParams params{};
|
||||||
|
params.magnitude = static_cast<uint8_t>(getConfigValue("magnitude"));
|
||||||
|
params.radius = static_cast<uint8_t>(getConfigValue("radius"));
|
||||||
|
params.disp_diff = static_cast<uint16_t>(getConfigValue("disp_diff"));
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the spatial moderate filter params.
|
||||||
|
*
|
||||||
|
* @param params OBSpatialModerateFilterParams.
|
||||||
|
*/
|
||||||
|
void setFilterParams(OBSpatialModerateFilterParams params) {
|
||||||
|
setConfigValue("magnitude", params.magnitude);
|
||||||
|
setConfigValue("radius", params.radius);
|
||||||
|
setConfigValue("disp_diff", params.disp_diff);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Hole filling filter,the processing performed depends on the selected hole filling mode.
|
* @brief Hole filling filter,the processing performed depends on the selected hole filling mode.
|
||||||
*/
|
*/
|
||||||
class HoleFillingFilter : public Filter {
|
class HoleFillingFilter : public Filter {
|
||||||
public:
|
public:
|
||||||
HoleFillingFilter(const std::string &activationKey = "") {
|
HoleFillingFilter(const std::string &activationKey = "") {
|
||||||
ob_error *error = nullptr;
|
ob_error *error = nullptr;
|
||||||
auto impl = ob_create_private_filter("HoleFillingFilter", activationKey.c_str(), &error);
|
auto impl = ob_create_private_filter("HoleFillingFilter", activationKey.c_str(), &error);
|
||||||
@@ -816,7 +951,7 @@ public:
|
|||||||
* @brief The noise removal filter,removing scattering depth pixels.
|
* @brief The noise removal filter,removing scattering depth pixels.
|
||||||
*/
|
*/
|
||||||
class NoiseRemovalFilter : public Filter {
|
class NoiseRemovalFilter : public Filter {
|
||||||
public:
|
public:
|
||||||
NoiseRemovalFilter(const std::string &activationKey = "") {
|
NoiseRemovalFilter(const std::string &activationKey = "") {
|
||||||
ob_error *error = nullptr;
|
ob_error *error = nullptr;
|
||||||
auto impl = ob_create_private_filter("NoiseRemovalFilter", activationKey.c_str(), &error);
|
auto impl = ob_create_private_filter("NoiseRemovalFilter", activationKey.c_str(), &error);
|
||||||
@@ -857,8 +992,8 @@ public:
|
|||||||
OBUint16PropertyRange getDispDiffRange() {
|
OBUint16PropertyRange getDispDiffRange() {
|
||||||
OBUint16PropertyRange range{};
|
OBUint16PropertyRange range{};
|
||||||
const auto &schemaVec = getConfigSchemaVec();
|
const auto &schemaVec = getConfigSchemaVec();
|
||||||
for(const auto &item: schemaVec) {
|
for (const auto &item : schemaVec) {
|
||||||
if(strcmp(item.name, "min_diff") == 0) {
|
if (strcmp(item.name, "min_diff") == 0) {
|
||||||
range = getPropertyRange<OBUint16PropertyRange>(item, getConfigValue("min_diff"));
|
range = getPropertyRange<OBUint16PropertyRange>(item, getConfigValue("min_diff"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -873,8 +1008,8 @@ public:
|
|||||||
OBUint16PropertyRange getMaxSizeRange() {
|
OBUint16PropertyRange getMaxSizeRange() {
|
||||||
OBUint16PropertyRange range{};
|
OBUint16PropertyRange range{};
|
||||||
const auto &schemaVec = getConfigSchemaVec();
|
const auto &schemaVec = getConfigSchemaVec();
|
||||||
for(const auto &item: schemaVec) {
|
for (const auto &item : schemaVec) {
|
||||||
if(strcmp(item.name, "max_size") == 0) {
|
if (strcmp(item.name, "max_size") == 0) {
|
||||||
range = getPropertyRange<OBUint16PropertyRange>(item, getConfigValue("max_size"));
|
range = getPropertyRange<OBUint16PropertyRange>(item, getConfigValue("max_size"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -887,7 +1022,7 @@ public:
|
|||||||
* @brief Temporal filter
|
* @brief Temporal filter
|
||||||
*/
|
*/
|
||||||
class TemporalFilter : public Filter {
|
class TemporalFilter : public Filter {
|
||||||
public:
|
public:
|
||||||
TemporalFilter(const std::string &activationKey = "") {
|
TemporalFilter(const std::string &activationKey = "") {
|
||||||
ob_error *error = nullptr;
|
ob_error *error = nullptr;
|
||||||
auto impl = ob_create_private_filter("TemporalFilter", activationKey.c_str(), &error);
|
auto impl = ob_create_private_filter("TemporalFilter", activationKey.c_str(), &error);
|
||||||
@@ -905,8 +1040,8 @@ public:
|
|||||||
OBFloatPropertyRange getDiffScaleRange() {
|
OBFloatPropertyRange getDiffScaleRange() {
|
||||||
OBFloatPropertyRange range{};
|
OBFloatPropertyRange range{};
|
||||||
const auto &schemaVec = getConfigSchemaVec();
|
const auto &schemaVec = getConfigSchemaVec();
|
||||||
for(const auto &item: schemaVec) {
|
for (const auto &item : schemaVec) {
|
||||||
if(strcmp(item.name, "diff_scale") == 0) {
|
if (strcmp(item.name, "diff_scale") == 0) {
|
||||||
range = getPropertyRange<OBFloatPropertyRange>(item, getConfigValue("diff_scale"));
|
range = getPropertyRange<OBFloatPropertyRange>(item, getConfigValue("diff_scale"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -919,9 +1054,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @param value diffscale value.
|
* @param value diffscale value.
|
||||||
*/
|
*/
|
||||||
void setDiffScale(float value) {
|
void setDiffScale(float value) { setConfigValue("diff_scale", static_cast<double>(value)); }
|
||||||
setConfigValue("diff_scale", static_cast<double>(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the TemporalFilter weight range.
|
* @brief Get the TemporalFilter weight range.
|
||||||
@@ -931,8 +1064,8 @@ public:
|
|||||||
OBFloatPropertyRange getWeightRange() {
|
OBFloatPropertyRange getWeightRange() {
|
||||||
OBFloatPropertyRange range{};
|
OBFloatPropertyRange range{};
|
||||||
const auto &schemaVec = getConfigSchemaVec();
|
const auto &schemaVec = getConfigSchemaVec();
|
||||||
for(const auto &item: schemaVec) {
|
for (const auto &item : schemaVec) {
|
||||||
if(strcmp(item.name, "weight") == 0) {
|
if (strcmp(item.name, "weight") == 0) {
|
||||||
range = getPropertyRange<OBFloatPropertyRange>(item, getConfigValue("weight"));
|
range = getPropertyRange<OBFloatPropertyRange>(item, getConfigValue("weight"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -945,16 +1078,14 @@ public:
|
|||||||
*
|
*
|
||||||
* @param value weight value.
|
* @param value weight value.
|
||||||
*/
|
*/
|
||||||
void setWeight(float value) {
|
void setWeight(float value) { setConfigValue("weight", static_cast<double>(value)); }
|
||||||
setConfigValue("weight", static_cast<double>(value));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Depth to disparity or disparity to depth
|
* @brief Depth to disparity or disparity to depth
|
||||||
*/
|
*/
|
||||||
class DisparityTransform : public Filter {
|
class DisparityTransform : public Filter {
|
||||||
public:
|
public:
|
||||||
DisparityTransform(const std::string &activationKey = "") {
|
DisparityTransform(const std::string &activationKey = "") {
|
||||||
ob_error *error = nullptr;
|
ob_error *error = nullptr;
|
||||||
auto impl = ob_create_private_filter("DisparityTransform", activationKey.c_str(), &error);
|
auto impl = ob_create_private_filter("DisparityTransform", activationKey.c_str(), &error);
|
||||||
@@ -966,10 +1097,10 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
class OBFilterList {
|
class OBFilterList {
|
||||||
private:
|
private:
|
||||||
ob_filter_list_t *impl_;
|
ob_filter_list_t *impl_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit OBFilterList(ob_filter_list_t *impl) : impl_(impl) {}
|
explicit OBFilterList(ob_filter_list_t *impl) : impl_(impl) {}
|
||||||
|
|
||||||
~OBFilterList() noexcept {
|
~OBFilterList() noexcept {
|
||||||
@@ -993,7 +1124,8 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @brief Get the Filter object at the specified index
|
* @brief Get the Filter object at the specified index
|
||||||
*
|
*
|
||||||
* @param index The filter index. The range is [0, count-1]. If the index exceeds the range, an exception will be thrown.
|
* @param index The filter index. The range is [0, count-1]. If the index exceeds the range, an
|
||||||
|
* exception will be thrown.
|
||||||
* @return std::shared_ptr<Filter> The filter object.
|
* @return std::shared_ptr<Filter> The filter object.
|
||||||
*/
|
*/
|
||||||
std::shared_ptr<Filter> getFilter(uint32_t index) {
|
std::shared_ptr<Filter> getFilter(uint32_t index) {
|
||||||
@@ -1003,32 +1135,38 @@ public:
|
|||||||
return std::make_shared<Filter>(filter);
|
return std::make_shared<Filter>(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||||
uint32_t count() const {
|
uint32_t count() const { return getCount(); }
|
||||||
return getCount();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Define the Filter type map
|
* @brief Define the Filter type map
|
||||||
*/
|
*/
|
||||||
static const std::unordered_map<std::string, std::type_index> obFilterTypeMap = {
|
static const std::unordered_map<std::string, std::type_index> obFilterTypeMap = {
|
||||||
{ "PointCloudFilter", typeid(PointCloudFilter) }, { "Align", typeid(Align) },
|
{"PointCloudFilter", typeid(PointCloudFilter)},
|
||||||
{ "FormatConverter", typeid(FormatConvertFilter) }, { "HDRMerge", typeid(HdrMerge) },
|
{"Align", typeid(Align)},
|
||||||
{ "SequenceIdFilter", typeid(SequenceIdFilter) }, { "DecimationFilter", typeid(DecimationFilter) },
|
{"FormatConverter", typeid(FormatConvertFilter)},
|
||||||
{ "ThresholdFilter", typeid(ThresholdFilter) }, { "SpatialAdvancedFilter", typeid(SpatialAdvancedFilter) },
|
{"HDRMerge", typeid(HdrMerge)},
|
||||||
{ "HoleFillingFilter", typeid(HoleFillingFilter) }, { "NoiseRemovalFilter", typeid(NoiseRemovalFilter) },
|
{"SequenceIdFilter", typeid(SequenceIdFilter)},
|
||||||
{ "TemporalFilter", typeid(TemporalFilter) }, { "DisparityTransform", typeid(DisparityTransform) }
|
{"DecimationFilter", typeid(DecimationFilter)},
|
||||||
};
|
{"ThresholdFilter", typeid(ThresholdFilter)},
|
||||||
|
{"SpatialAdvancedFilter", typeid(SpatialAdvancedFilter)},
|
||||||
|
{"HoleFillingFilter", typeid(HoleFillingFilter)},
|
||||||
|
{"NoiseRemovalFilter", typeid(NoiseRemovalFilter)},
|
||||||
|
{"TemporalFilter", typeid(TemporalFilter)},
|
||||||
|
{"DisparityTransform", typeid(DisparityTransform)},
|
||||||
|
{"SpatialFastFilter", typeid(SpatialFastFilter)},
|
||||||
|
{"SpatialModerateFilter", typeid(SpatialModerateFilter)}};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Define the is() template function for the Filter class
|
* @brief Define the is() template function for the Filter class
|
||||||
*/
|
*/
|
||||||
template <typename T> bool Filter::is() {
|
template <typename T>
|
||||||
|
bool Filter::is() {
|
||||||
std::string name = type();
|
std::string name = type();
|
||||||
auto it = obFilterTypeMap.find(name);
|
auto it = obFilterTypeMap.find(name);
|
||||||
if(it != obFilterTypeMap.end()) {
|
if (it != obFilterTypeMap.end()) {
|
||||||
return std::type_index(typeid(T)) == it->second;
|
return std::type_index(typeid(T)) == it->second;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ set(CMAKE_IMPORT_FILE_VERSION 1)
|
|||||||
# Import target "ob::OrbbecSDK" for configuration "Release"
|
# Import target "ob::OrbbecSDK" for configuration "Release"
|
||||||
set_property(TARGET ob::OrbbecSDK APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
set_property(TARGET ob::OrbbecSDK APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||||
set_target_properties(ob::OrbbecSDK PROPERTIES
|
set_target_properties(ob::OrbbecSDK PROPERTIES
|
||||||
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.4.8"
|
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.4.10"
|
||||||
IMPORTED_SONAME_RELEASE "libOrbbecSDK.so.2"
|
IMPORTED_SONAME_RELEASE "libOrbbecSDK.so.2"
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND _cmake_import_check_targets ob::OrbbecSDK )
|
list(APPEND _cmake_import_check_targets ob::OrbbecSDK )
|
||||||
list(APPEND _cmake_import_check_files_for_ob::OrbbecSDK "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.4.8" )
|
list(APPEND _cmake_import_check_files_for_ob::OrbbecSDK "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.4.10" )
|
||||||
|
|
||||||
# Commands beyond this point should not need to know the version.
|
# Commands beyond this point should not need to know the version.
|
||||||
set(CMAKE_IMPORT_FILE_VERSION)
|
set(CMAKE_IMPORT_FILE_VERSION)
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
|||||||
libOrbbecSDK.so.2.4.8
|
libOrbbecSDK.so.2.4.10
|
||||||
BIN
Binary file not shown.
@@ -8,12 +8,12 @@ set(CMAKE_IMPORT_FILE_VERSION 1)
|
|||||||
# Import target "ob::OrbbecSDK" for configuration "Release"
|
# Import target "ob::OrbbecSDK" for configuration "Release"
|
||||||
set_property(TARGET ob::OrbbecSDK APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
set_property(TARGET ob::OrbbecSDK APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||||
set_target_properties(ob::OrbbecSDK PROPERTIES
|
set_target_properties(ob::OrbbecSDK PROPERTIES
|
||||||
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.4.8"
|
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.4.10"
|
||||||
IMPORTED_SONAME_RELEASE "libOrbbecSDK.so.2"
|
IMPORTED_SONAME_RELEASE "libOrbbecSDK.so.2"
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND _cmake_import_check_targets ob::OrbbecSDK )
|
list(APPEND _cmake_import_check_targets ob::OrbbecSDK )
|
||||||
list(APPEND _cmake_import_check_files_for_ob::OrbbecSDK "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.4.8" )
|
list(APPEND _cmake_import_check_files_for_ob::OrbbecSDK "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.4.10" )
|
||||||
|
|
||||||
# Commands beyond this point should not need to know the version.
|
# Commands beyond this point should not need to know the version.
|
||||||
set(CMAKE_IMPORT_FILE_VERSION)
|
set(CMAKE_IMPORT_FILE_VERSION)
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
|||||||
libOrbbecSDK.so.2.4.8
|
libOrbbecSDK.so.2.4.10
|
||||||
BIN
Binary file not shown.
@@ -115,7 +115,7 @@ def generate_launch_description():
|
|||||||
DeclareLaunchArgument('depth_ae_roi_right', default_value='-1'),
|
DeclareLaunchArgument('depth_ae_roi_right', default_value='-1'),
|
||||||
DeclareLaunchArgument('depth_ae_roi_top', default_value='-1'),
|
DeclareLaunchArgument('depth_ae_roi_top', default_value='-1'),
|
||||||
DeclareLaunchArgument('depth_ae_roi_bottom', default_value='-1'),
|
DeclareLaunchArgument('depth_ae_roi_bottom', default_value='-1'),
|
||||||
DeclareLaunchArgument('depth_brightness', default_value='-1'),
|
DeclareLaunchArgument('mean_intensity_set_point', default_value='-1'),
|
||||||
DeclareLaunchArgument('left_ir_width', default_value='0'),
|
DeclareLaunchArgument('left_ir_width', default_value='0'),
|
||||||
DeclareLaunchArgument('left_ir_height', default_value='0'),
|
DeclareLaunchArgument('left_ir_height', default_value='0'),
|
||||||
DeclareLaunchArgument('left_ir_fps', default_value='0'),
|
DeclareLaunchArgument('left_ir_fps', default_value='0'),
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ def generate_launch_description():
|
|||||||
DeclareLaunchArgument('depth_ae_roi_right', default_value='-1'),
|
DeclareLaunchArgument('depth_ae_roi_right', default_value='-1'),
|
||||||
DeclareLaunchArgument('depth_ae_roi_top', default_value='-1'),
|
DeclareLaunchArgument('depth_ae_roi_top', default_value='-1'),
|
||||||
DeclareLaunchArgument('depth_ae_roi_bottom', default_value='-1'),
|
DeclareLaunchArgument('depth_ae_roi_bottom', default_value='-1'),
|
||||||
DeclareLaunchArgument('depth_brightness', default_value='-1'),
|
DeclareLaunchArgument('mean_intensity_set_point', default_value='-1'),
|
||||||
DeclareLaunchArgument('left_ir_width', default_value='0'),
|
DeclareLaunchArgument('left_ir_width', default_value='0'),
|
||||||
DeclareLaunchArgument('left_ir_height', default_value='0'),
|
DeclareLaunchArgument('left_ir_height', default_value='0'),
|
||||||
DeclareLaunchArgument('left_ir_fps', default_value='0'),
|
DeclareLaunchArgument('left_ir_fps', default_value='0'),
|
||||||
|
|||||||
+1
-1
@@ -115,7 +115,7 @@ def generate_launch_description():
|
|||||||
DeclareLaunchArgument('depth_ae_roi_right', default_value='-1'),
|
DeclareLaunchArgument('depth_ae_roi_right', default_value='-1'),
|
||||||
DeclareLaunchArgument('depth_ae_roi_top', default_value='-1'),
|
DeclareLaunchArgument('depth_ae_roi_top', default_value='-1'),
|
||||||
DeclareLaunchArgument('depth_ae_roi_bottom', default_value='-1'),
|
DeclareLaunchArgument('depth_ae_roi_bottom', default_value='-1'),
|
||||||
DeclareLaunchArgument('depth_brightness', default_value='-1'),
|
DeclareLaunchArgument('mean_intensity_set_point', default_value='-1'),
|
||||||
DeclareLaunchArgument('left_ir_width', default_value='0'),
|
DeclareLaunchArgument('left_ir_width', default_value='0'),
|
||||||
DeclareLaunchArgument('left_ir_height', default_value='0'),
|
DeclareLaunchArgument('left_ir_height', default_value='0'),
|
||||||
DeclareLaunchArgument('left_ir_fps', default_value='0'),
|
DeclareLaunchArgument('left_ir_fps', default_value='0'),
|
||||||
|
|||||||
@@ -566,7 +566,7 @@ class OBCameraNode {
|
|||||||
int depth_ae_roi_top_ = -1;
|
int depth_ae_roi_top_ = -1;
|
||||||
int depth_ae_roi_right_ = -1;
|
int depth_ae_roi_right_ = -1;
|
||||||
int depth_ae_roi_bottom_ = -1;
|
int depth_ae_roi_bottom_ = -1;
|
||||||
int depth_brightness_ = -1;
|
int mean_intensity_set_point_ = -1;
|
||||||
int ir_exposure_ = -1;
|
int ir_exposure_ = -1;
|
||||||
int ir_gain_ = -1;
|
int ir_gain_ = -1;
|
||||||
int ir_ae_max_exposure_ = -1;
|
int ir_ae_max_exposure_ = -1;
|
||||||
@@ -631,6 +631,8 @@ class OBCameraNode {
|
|||||||
bool enable_spatial_filter_ = true;
|
bool enable_spatial_filter_ = true;
|
||||||
bool enable_temporal_filter_ = false;
|
bool enable_temporal_filter_ = false;
|
||||||
bool enable_hole_filling_filter_ = false;
|
bool enable_hole_filling_filter_ = false;
|
||||||
|
bool enable_spatial_fast_filter_ = false;
|
||||||
|
bool enable_spatial_moderate_filter_ = false;
|
||||||
// filter params
|
// filter params
|
||||||
int decimation_filter_scale_ = -1;
|
int decimation_filter_scale_ = -1;
|
||||||
int sequence_id_filter_id_ = -1;
|
int sequence_id_filter_id_ = -1;
|
||||||
@@ -653,7 +655,10 @@ class OBCameraNode {
|
|||||||
int gmsl_trigger_fd_ = -1;
|
int gmsl_trigger_fd_ = -1;
|
||||||
int gmsl_trigger_fps_ = -1;
|
int gmsl_trigger_fps_ = -1;
|
||||||
bool enable_gmsl_trigger_ = false;
|
bool enable_gmsl_trigger_ = false;
|
||||||
|
int spatial_fast_filter_radius_ = -1;
|
||||||
|
int spatial_moderate_filter_radius_ = -1;
|
||||||
|
int spatial_moderate_filter_diff_threshold_ = -1;
|
||||||
|
int spatial_moderate_filter_magnitude_ = -1;
|
||||||
rclcpp::Publisher<std_msgs::msg::String>::SharedPtr filter_status_pub_;
|
rclcpp::Publisher<std_msgs::msg::String>::SharedPtr filter_status_pub_;
|
||||||
nlohmann::json filter_status_;
|
nlohmann::json filter_status_;
|
||||||
std::string align_mode_ = "HW";
|
std::string align_mode_ = "HW";
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ def generate_launch_description():
|
|||||||
DeclareLaunchArgument('depth_camera_info_qos', default_value='default'),
|
DeclareLaunchArgument('depth_camera_info_qos', default_value='default'),
|
||||||
DeclareLaunchArgument('enable_depth_auto_exposure_priority', default_value='false'),
|
DeclareLaunchArgument('enable_depth_auto_exposure_priority', default_value='false'),
|
||||||
DeclareLaunchArgument('depth_precision', default_value=''),
|
DeclareLaunchArgument('depth_precision', default_value=''),
|
||||||
DeclareLaunchArgument('depth_brightness', default_value='-1'),
|
DeclareLaunchArgument('mean_intensity_set_point', default_value='-1'),
|
||||||
DeclareLaunchArgument('left_ir_width', default_value='0'),
|
DeclareLaunchArgument('left_ir_width', default_value='0'),
|
||||||
DeclareLaunchArgument('left_ir_height', default_value='0'),
|
DeclareLaunchArgument('left_ir_height', default_value='0'),
|
||||||
DeclareLaunchArgument('left_ir_fps', default_value='0'),
|
DeclareLaunchArgument('left_ir_fps', default_value='0'),
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ def generate_launch_description():
|
|||||||
DeclareLaunchArgument('depth_camera_info_qos', default_value='default'),
|
DeclareLaunchArgument('depth_camera_info_qos', default_value='default'),
|
||||||
DeclareLaunchArgument('enable_depth_auto_exposure_priority', default_value='false'),
|
DeclareLaunchArgument('enable_depth_auto_exposure_priority', default_value='false'),
|
||||||
DeclareLaunchArgument('depth_precision', default_value=''),
|
DeclareLaunchArgument('depth_precision', default_value=''),
|
||||||
DeclareLaunchArgument('depth_brightness', default_value='-1'),
|
DeclareLaunchArgument('mean_intensity_set_point', default_value='-1'),
|
||||||
DeclareLaunchArgument('left_ir_width', default_value='0'),
|
DeclareLaunchArgument('left_ir_width', default_value='0'),
|
||||||
DeclareLaunchArgument('left_ir_height', default_value='0'),
|
DeclareLaunchArgument('left_ir_height', default_value='0'),
|
||||||
DeclareLaunchArgument('left_ir_fps', default_value='0'),
|
DeclareLaunchArgument('left_ir_fps', default_value='0'),
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ def generate_launch_description():
|
|||||||
DeclareLaunchArgument('depth_ae_roi_right', default_value='-1'),
|
DeclareLaunchArgument('depth_ae_roi_right', default_value='-1'),
|
||||||
DeclareLaunchArgument('depth_ae_roi_top', default_value='-1'),
|
DeclareLaunchArgument('depth_ae_roi_top', default_value='-1'),
|
||||||
DeclareLaunchArgument('depth_ae_roi_bottom', default_value='-1'),
|
DeclareLaunchArgument('depth_ae_roi_bottom', default_value='-1'),
|
||||||
DeclareLaunchArgument('depth_brightness', default_value='-1'),
|
DeclareLaunchArgument('mean_intensity_set_point', default_value='-1'),
|
||||||
DeclareLaunchArgument('left_ir_width', default_value='0'),
|
DeclareLaunchArgument('left_ir_width', default_value='0'),
|
||||||
DeclareLaunchArgument('left_ir_height', default_value='0'),
|
DeclareLaunchArgument('left_ir_height', default_value='0'),
|
||||||
DeclareLaunchArgument('left_ir_fps', default_value='0'),
|
DeclareLaunchArgument('left_ir_fps', default_value='0'),
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ def generate_launch_description():
|
|||||||
DeclareLaunchArgument('depth_ae_roi_right', default_value='-1'),
|
DeclareLaunchArgument('depth_ae_roi_right', default_value='-1'),
|
||||||
DeclareLaunchArgument('depth_ae_roi_top', default_value='-1'),
|
DeclareLaunchArgument('depth_ae_roi_top', default_value='-1'),
|
||||||
DeclareLaunchArgument('depth_ae_roi_bottom', default_value='-1'),
|
DeclareLaunchArgument('depth_ae_roi_bottom', default_value='-1'),
|
||||||
DeclareLaunchArgument('depth_brightness', default_value='-1'),
|
DeclareLaunchArgument('mean_intensity_set_point', default_value='-1'),
|
||||||
DeclareLaunchArgument('left_ir_width', default_value='0'),
|
DeclareLaunchArgument('left_ir_width', default_value='0'),
|
||||||
DeclareLaunchArgument('left_ir_height', default_value='0'),
|
DeclareLaunchArgument('left_ir_height', default_value='0'),
|
||||||
DeclareLaunchArgument('left_ir_fps', default_value='0'),
|
DeclareLaunchArgument('left_ir_fps', default_value='0'),
|
||||||
@@ -195,6 +195,8 @@ def generate_launch_description():
|
|||||||
DeclareLaunchArgument('enable_temporal_filter', default_value='false'),
|
DeclareLaunchArgument('enable_temporal_filter', default_value='false'),
|
||||||
DeclareLaunchArgument('enable_disaparity_to_depth', default_value='true'),
|
DeclareLaunchArgument('enable_disaparity_to_depth', default_value='true'),
|
||||||
DeclareLaunchArgument('enable_hole_filling_filter', default_value='false'),
|
DeclareLaunchArgument('enable_hole_filling_filter', default_value='false'),
|
||||||
|
DeclareLaunchArgument('enable_spatial_fast_filter', default_value='false'),
|
||||||
|
DeclareLaunchArgument('enable_spatial_moderate_filter', default_value='false'),
|
||||||
DeclareLaunchArgument('decimation_filter_scale', default_value='-1'),
|
DeclareLaunchArgument('decimation_filter_scale', default_value='-1'),
|
||||||
DeclareLaunchArgument('sequence_id_filter_id', default_value='-1'),
|
DeclareLaunchArgument('sequence_id_filter_id', default_value='-1'),
|
||||||
DeclareLaunchArgument('threshold_filter_max', default_value='-1'),
|
DeclareLaunchArgument('threshold_filter_max', default_value='-1'),
|
||||||
@@ -213,6 +215,10 @@ def generate_launch_description():
|
|||||||
DeclareLaunchArgument('hdr_merge_gain_1', default_value='-1'),
|
DeclareLaunchArgument('hdr_merge_gain_1', default_value='-1'),
|
||||||
DeclareLaunchArgument('hdr_merge_exposure_2', default_value='-1'),
|
DeclareLaunchArgument('hdr_merge_exposure_2', default_value='-1'),
|
||||||
DeclareLaunchArgument('hdr_merge_gain_2', default_value='-1'),
|
DeclareLaunchArgument('hdr_merge_gain_2', default_value='-1'),
|
||||||
|
DeclareLaunchArgument('spatial_fast_filter_radius', default_value='-1'),
|
||||||
|
DeclareLaunchArgument('spatial_moderate_filter_diff_threshold', default_value='-1'),
|
||||||
|
DeclareLaunchArgument('spatial_moderate_filter_magnitude', default_value='-1'),
|
||||||
|
DeclareLaunchArgument('spatial_moderate_filter_radius', default_value='-1'),
|
||||||
DeclareLaunchArgument('align_mode', default_value='SW'),
|
DeclareLaunchArgument('align_mode', default_value='SW'),
|
||||||
DeclareLaunchArgument('align_target_stream', default_value='COLOR'),# COLOR or DEPTH
|
DeclareLaunchArgument('align_target_stream', default_value='COLOR'),# COLOR or DEPTH
|
||||||
DeclareLaunchArgument('diagnostic_period', default_value='1.0'),
|
DeclareLaunchArgument('diagnostic_period', default_value='1.0'),
|
||||||
@@ -260,8 +266,7 @@ def generate_launch_description():
|
|||||||
DeclareLaunchArgument('laser_index0_depth_gain', default_value='16'),
|
DeclareLaunchArgument('laser_index0_depth_gain', default_value='16'),
|
||||||
DeclareLaunchArgument('laser_index0_ir_brightness', default_value='60'),
|
DeclareLaunchArgument('laser_index0_ir_brightness', default_value='60'),
|
||||||
DeclareLaunchArgument('laser_index0_ir_ae_max_exposure', default_value='30000'),
|
DeclareLaunchArgument('laser_index0_ir_ae_max_exposure', default_value='30000'),
|
||||||
|
DeclareLaunchArgument('show_fps_enable', default_value='false'),
|
||||||
DeclareLaunchArgument('show_fps_enable', default_value='true'),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
def get_params(context, args):
|
def get_params(context, args):
|
||||||
|
|||||||
@@ -573,15 +573,15 @@ void OBCameraNode::setupDevices() {
|
|||||||
TRY_TO_SET_PROPERTY(setIntProperty, OB_PROP_DEPTH_AUTO_EXPOSURE_PRIORITY_INT,
|
TRY_TO_SET_PROPERTY(setIntProperty, OB_PROP_DEPTH_AUTO_EXPOSURE_PRIORITY_INT,
|
||||||
set_enable_depth_auto_exposure_priority);
|
set_enable_depth_auto_exposure_priority);
|
||||||
}
|
}
|
||||||
if (depth_brightness_ != -1 &&
|
if (mean_intensity_set_point_ != -1 &&
|
||||||
device_->isPropertySupported(OB_PROP_IR_BRIGHTNESS_INT, OB_PERMISSION_WRITE)) {
|
device_->isPropertySupported(OB_PROP_IR_BRIGHTNESS_INT, OB_PERMISSION_WRITE)) {
|
||||||
auto range = device_->getIntPropertyRange(OB_PROP_IR_BRIGHTNESS_INT);
|
auto range = device_->getIntPropertyRange(OB_PROP_IR_BRIGHTNESS_INT);
|
||||||
if (depth_brightness_ < range.min || depth_brightness_ > range.max) {
|
if (mean_intensity_set_point_ < range.min || mean_intensity_set_point_ > range.max) {
|
||||||
RCLCPP_ERROR(logger_, "depth brightness value is out of range[%d,%d], please check the value",
|
RCLCPP_ERROR(logger_, "depth brightness value is out of range[%d,%d], please check the value",
|
||||||
range.min, range.max);
|
range.min, range.max);
|
||||||
} else {
|
} else {
|
||||||
RCLCPP_INFO_STREAM(logger_, "Setting depth brightness to " << depth_brightness_);
|
RCLCPP_INFO_STREAM(logger_, "Setting depth brightness to " << mean_intensity_set_point_);
|
||||||
TRY_TO_SET_PROPERTY(setIntProperty, OB_PROP_IR_BRIGHTNESS_INT, depth_brightness_);
|
TRY_TO_SET_PROPERTY(setIntProperty, OB_PROP_IR_BRIGHTNESS_INT, mean_intensity_set_point_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ir ae max
|
// ir ae max
|
||||||
@@ -898,6 +898,8 @@ void OBCameraNode::setupDepthPostProcessFilter() {
|
|||||||
{"HoleFillingFilter", enable_hole_filling_filter_},
|
{"HoleFillingFilter", enable_hole_filling_filter_},
|
||||||
{"DisparityTransform", enable_disaparity_to_depth_},
|
{"DisparityTransform", enable_disaparity_to_depth_},
|
||||||
{"ThresholdFilter", enable_threshold_filter_},
|
{"ThresholdFilter", enable_threshold_filter_},
|
||||||
|
{"SpatialFastFilter", enable_spatial_fast_filter_},
|
||||||
|
{"SpatialModerateFilter", enable_spatial_moderate_filter_},
|
||||||
};
|
};
|
||||||
std::string filter_name = filter->type();
|
std::string filter_name = filter->type();
|
||||||
RCLCPP_INFO_STREAM(logger_, "Setting " << filter_name << "......");
|
RCLCPP_INFO_STREAM(logger_, "Setting " << filter_name << "......");
|
||||||
@@ -979,6 +981,29 @@ void OBCameraNode::setupDepthPostProcessFilter() {
|
|||||||
device_->setStructuredData(OB_STRUCT_DEPTH_HDR_CONFIG,
|
device_->setStructuredData(OB_STRUCT_DEPTH_HDR_CONFIG,
|
||||||
reinterpret_cast<const uint8_t *>(&config), sizeof(config));
|
reinterpret_cast<const uint8_t *>(&config), sizeof(config));
|
||||||
}
|
}
|
||||||
|
} else if (filter_name == "SpatialFastFilter" && enable_spatial_fast_filter_) {
|
||||||
|
auto spatial_fast_filter = filter->as<ob::SpatialFastFilter>();
|
||||||
|
OBSpatialFastFilterParams params{};
|
||||||
|
if (spatial_fast_filter_radius_ != -1) {
|
||||||
|
params.radius = spatial_fast_filter_radius_;
|
||||||
|
RCLCPP_INFO_STREAM(logger_,
|
||||||
|
"Set SpatialFastFilter radius to " << spatial_fast_filter_radius_);
|
||||||
|
spatial_fast_filter->setFilterParams(params);
|
||||||
|
}
|
||||||
|
} else if (filter_name == "SpatialModerateFilter" && enable_spatial_moderate_filter_) {
|
||||||
|
auto spatial_moderate_filter = filter->as<ob::SpatialModerateFilter>();
|
||||||
|
OBSpatialModerateFilterParams params{};
|
||||||
|
if (spatial_moderate_filter_diff_threshold_ != -1 &&
|
||||||
|
spatial_moderate_filter_magnitude_ != -1 && spatial_moderate_filter_radius_ != -1) {
|
||||||
|
params.magnitude = spatial_moderate_filter_magnitude_;
|
||||||
|
params.radius = spatial_moderate_filter_radius_;
|
||||||
|
params.disp_diff = spatial_moderate_filter_diff_threshold_;
|
||||||
|
RCLCPP_INFO_STREAM(logger_, "Set SpatialModerateFilter params: "
|
||||||
|
<< "magnitude=" << params.magnitude << ", radius="
|
||||||
|
<< params.radius << ", disp_diff=" << params.disp_diff);
|
||||||
|
spatial_moderate_filter->setFilterParams(params);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
RCLCPP_INFO_STREAM(logger_, "Skip setting filter: " << filter_name);
|
RCLCPP_INFO_STREAM(logger_, "Skip setting filter: " << filter_name);
|
||||||
}
|
}
|
||||||
@@ -1648,7 +1673,7 @@ void OBCameraNode::getParameters() {
|
|||||||
setAndGetNodeParameter<int>(depth_ae_roi_top_, "depth_ae_roi_top", -1);
|
setAndGetNodeParameter<int>(depth_ae_roi_top_, "depth_ae_roi_top", -1);
|
||||||
setAndGetNodeParameter<int>(depth_ae_roi_right_, "depth_ae_roi_right", -1);
|
setAndGetNodeParameter<int>(depth_ae_roi_right_, "depth_ae_roi_right", -1);
|
||||||
setAndGetNodeParameter<int>(depth_ae_roi_bottom_, "depth_ae_roi_bottom", -1);
|
setAndGetNodeParameter<int>(depth_ae_roi_bottom_, "depth_ae_roi_bottom", -1);
|
||||||
setAndGetNodeParameter<int>(depth_brightness_, "depth_brightness", -1);
|
setAndGetNodeParameter<int>(mean_intensity_set_point_, "mean_intensity_set_point", -1);
|
||||||
setAndGetNodeParameter<std::string>(depth_precision_str_, "depth_precision", "");
|
setAndGetNodeParameter<std::string>(depth_precision_str_, "depth_precision", "");
|
||||||
setAndGetNodeParameter<bool>(enable_ir_auto_exposure_, "enable_ir_auto_exposure", true);
|
setAndGetNodeParameter<bool>(enable_ir_auto_exposure_, "enable_ir_auto_exposure", true);
|
||||||
setAndGetNodeParameter<int>(ir_exposure_, "ir_exposure", -1);
|
setAndGetNodeParameter<int>(ir_exposure_, "ir_exposure", -1);
|
||||||
@@ -1699,6 +1724,9 @@ void OBCameraNode::getParameters() {
|
|||||||
setAndGetNodeParameter<bool>(enable_spatial_filter_, "enable_spatial_filter", false);
|
setAndGetNodeParameter<bool>(enable_spatial_filter_, "enable_spatial_filter", false);
|
||||||
setAndGetNodeParameter<bool>(enable_temporal_filter_, "enable_temporal_filter", false);
|
setAndGetNodeParameter<bool>(enable_temporal_filter_, "enable_temporal_filter", false);
|
||||||
setAndGetNodeParameter<bool>(enable_hole_filling_filter_, "enable_hole_filling_filter", false);
|
setAndGetNodeParameter<bool>(enable_hole_filling_filter_, "enable_hole_filling_filter", false);
|
||||||
|
setAndGetNodeParameter<bool>(enable_spatial_fast_filter_, "enable_spatial_fast_filter", false);
|
||||||
|
setAndGetNodeParameter<bool>(enable_spatial_moderate_filter_, "enable_spatial_moderate_filter",
|
||||||
|
false);
|
||||||
setAndGetNodeParameter<int>(decimation_filter_scale_, "decimation_filter_scale", -1);
|
setAndGetNodeParameter<int>(decimation_filter_scale_, "decimation_filter_scale", -1);
|
||||||
setAndGetNodeParameter<int>(sequence_id_filter_id_, "sequence_id_filter_id", -1);
|
setAndGetNodeParameter<int>(sequence_id_filter_id_, "sequence_id_filter_id", -1);
|
||||||
setAndGetNodeParameter<int>(threshold_filter_max_, "threshold_filter_max", -1);
|
setAndGetNodeParameter<int>(threshold_filter_max_, "threshold_filter_max", -1);
|
||||||
@@ -3688,13 +3716,42 @@ void OBCameraNode::setFilterCallback(const std::shared_ptr<SetFilter ::Request>
|
|||||||
"The filter switch setting is successful, but the filter parameter setting fails";
|
"The filter switch setting is successful, but the filter parameter setting fails";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} else if (request->filter_name == "SpatialFastFilter") {
|
||||||
|
auto spatial_fast_filter = std::make_shared<ob::SpatialFastFilter>();
|
||||||
|
spatial_fast_filter->enable(request->filter_enable);
|
||||||
|
depth_filter_list_.push_back(spatial_fast_filter);
|
||||||
|
if (request->filter_param.size() > 0) {
|
||||||
|
OBSpatialFastFilterParams params{};
|
||||||
|
params.radius = request->filter_param[0];
|
||||||
|
spatial_fast_filter->setFilterParams(params);
|
||||||
|
RCLCPP_INFO_STREAM(logger_, "Set SpatialFastFilter radius to " << params.radius);
|
||||||
|
} else {
|
||||||
|
response->message =
|
||||||
|
"The filter switch setting is successful, but the filter parameter setting fails";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (request->filter_name == "SpatialModerateFilter") {
|
||||||
|
auto spatial_moderate_filter = std::make_shared<ob::SpatialModerateFilter>();
|
||||||
|
spatial_moderate_filter->enable(request->filter_enable);
|
||||||
|
depth_filter_list_.push_back(spatial_moderate_filter);
|
||||||
|
if (request->filter_param.size() > 2) {
|
||||||
|
OBSpatialModerateFilterParams params{};
|
||||||
|
params.disp_diff = request->filter_param[0];
|
||||||
|
params.magnitude = request->filter_param[1];
|
||||||
|
params.radius = request->filter_param[2];
|
||||||
|
spatial_moderate_filter->setFilterParams(params);
|
||||||
|
RCLCPP_INFO_STREAM(logger_, "Set SpatialModerateFilter params: "
|
||||||
|
<< "\ndisp_diff:" << params.disp_diff << "\nmagnitude:"
|
||||||
|
<< params.magnitude << "\nradius:" << params.radius);
|
||||||
} else {
|
} else {
|
||||||
RCLCPP_INFO_STREAM(
|
RCLCPP_INFO_STREAM(
|
||||||
logger_, request->filter_name
|
logger_, request->filter_name
|
||||||
<< "Cannot be set\n"
|
<< "Cannot be set\n"
|
||||||
<< "The filter_name value that can be set is "
|
<< "The filter_name value that can be set is "
|
||||||
"DecimationFilter, HDRMerge, SequenceIdFilter, ThresholdFilter, Nois"
|
"DecimationFilter, HDRMerge, SequenceIdFilter, ThresholdFilter, "
|
||||||
"eRemovalFilter, SpatialAdvancedFilter and TemporalFilter");
|
"NoiseRemovalFilter, HardwareNoiseRemoval, SpatialAdvancedFilter, "
|
||||||
|
"SpatialFastFilter, SpatialModerateFilter and TemporalFilter");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (auto &filter : depth_filter_list_) {
|
for (auto &filter : depth_filter_list_) {
|
||||||
@@ -3708,6 +3765,7 @@ void OBCameraNode::setFilterCallback(const std::shared_ptr<SetFilter ::Request>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
response->success = true;
|
response->success = true;
|
||||||
|
}
|
||||||
} catch (const ob::Error &e) {
|
} catch (const ob::Error &e) {
|
||||||
response->message = e.getMessage();
|
response->message = e.getMessage();
|
||||||
response->success = false;
|
response->success = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user