update OrbbecSDK arm64 version to 2.9.1 enhance_filter

This commit is contained in:
ob-yalian
2026-06-30 10:39:50 +08:00
parent fdc0d1fe9c
commit ad23464af7
14 changed files with 381 additions and 27 deletions
@@ -302,6 +302,51 @@ public:
Error::handle(&error);
}
/**
* @brief Check whether the device supports license authorization.
*
* @return true if the device supports license authorization, false otherwise.
*/
bool isLicenseAuthorizationSupported() const {
ob_error *error = nullptr;
auto res = ob_device_is_license_authorization_supported(impl_, &error);
Error::handle(&error);
return res;
}
/**
* @brief Write signed device license information.
*
* @param[in] licenseInfo SDK license_info JSON string
*/
void writeLicenseInfo(const std::string &licenseInfo) const {
ob_error *error = nullptr;
ob_device_write_license_info(impl_, licenseInfo.c_str(), static_cast<uint32_t>(licenseInfo.size()), &error);
Error::handle(&error);
}
/**
* @brief Clear license information stored on the device.
*/
void clearLicenseInfo() const {
ob_error *error = nullptr;
ob_device_clear_license_info(impl_, &error);
Error::handle(&error);
}
/**
* @brief Read signed device license information as SDK license_info JSON.
*
* @return std::string SDK license_info JSON string
*/
std::string readLicenseInfo() const {
ob_error *error = nullptr;
char buf[4096] = {};
ob_device_read_license_info(impl_, buf, sizeof(buf), &error);
Error::handle(&error);
return std::string(buf);
}
/**
* @brief Set the customer data type of a device property
*
@@ -1449,9 +1494,9 @@ public:
*
* @return const char* The host network interface name (e.g., "eth0", "en0").
*/
const char* getLocalNetInterfaceName(uint32_t index) const {
ob_error *error = nullptr;
auto netItfName = ob_device_list_get_device_local_net_if_name(impl_, index, &error);
const char *getLocalNetInterfaceName(uint32_t index) const {
ob_error *error = nullptr;
auto netItfName = ob_device_list_get_device_local_net_if_name(impl_, index, &error);
Error::handle(&error);
return netItfName;
}
@@ -22,6 +22,7 @@
#include <typeinfo>
#include <typeindex>
#include <unordered_map>
#include <vector>
#include <cstring>
namespace ob {
@@ -34,25 +35,15 @@ typedef std::function<void(std::shared_ptr<Frame>)> FilterCallback;
/**
* @brief Get the type of a PropertyRange member
*/
template <typename T> struct RangeTraits {
using valueType = void;
};
template <typename T> struct RangeTraits { using valueType = void; };
template <> struct RangeTraits<OBUint8PropertyRange> {
using valueType = uint8_t;
};
template <> struct RangeTraits<OBUint8PropertyRange> { using valueType = uint8_t; };
template <> struct RangeTraits<OBUint16PropertyRange> {
using valueType = uint16_t;
};
template <> struct RangeTraits<OBUint16PropertyRange> { using valueType = uint16_t; };
template <> struct RangeTraits<OBIntPropertyRange> {
using valueType = uint32_t;
};
template <> struct RangeTraits<OBIntPropertyRange> { using valueType = uint32_t; };
template <> struct RangeTraits<OBFloatPropertyRange> {
using valueType = float;
};
template <> struct RangeTraits<OBFloatPropertyRange> { using valueType = float; };
/**
* @brief Get T Property Range
@@ -2081,6 +2072,175 @@ public:
~DisparityTransform() noexcept override = default;
};
/**
* @brief Enhanced depth filter that requires a device for activation.
*
* @note The constructor is a template so that Filter.hpp does not need to include Device.hpp.
* The template is instantiated at the call site where the device type is complete.
*/
class EnhancedDepthFilter : public Filter {
public:
/**
* @brief Construct an EnhancedDepthFilter and activate it for the given device.
*
* @param[in] device The device the filter is bound to.
* @param[in] modelPath Optional path to the inference model file used during activation. When empty, the
* filter falls back to its default model file at extensions/filters/enhanced_depth_filter/model.sm4
* (located next to the filter library).
*/
template <typename T> explicit EnhancedDepthFilter(std::shared_ptr<T> device, const std::string &modelPath = "") {
if(!device) {
throw std::invalid_argument("device is null");
}
ob_error *error = nullptr;
auto impl = ob_create_private_filter("EnhancedDepthFilter", "", &error);
Error::handle(&error);
// Only pass options when a model path is provided; otherwise hand down nullptr so the filter uses its default.
ob_priv_filter_activate_options options{};
ob_priv_filter_activate_options *optionsPtr = nullptr;
if(!modelPath.empty()) {
options.struct_size = sizeof(options);
options.model_path = modelPath.c_str();
optionsPtr = &options;
}
ob_filter_activate_private_ex(impl, device->getImpl(), optionsPtr, &error);
Error::handle(&error);
init(impl);
}
~EnhancedDepthFilter() noexcept override = default;
/**
* @brief Get the resolutions supported by the enhanced depth filter for the constrained (aligned-to) stream.
*
* @return The list of supported {width, height} pairs. This is the single source of truth used by
* @ref isSupportedResolution.
*/
static const std::vector<std::pair<uint32_t, uint32_t>> &getSupportedResolutions() {
static const std::vector<std::pair<uint32_t, uint32_t>> supportedResolutions = {
{ 640, 480 },
{ 1280, 720 },
{ 1920, 1080 },
};
return supportedResolutions;
}
/**
* @brief Get the frame formats supported by the enhanced depth filter for a given stream type.
*
* @param[in] streamType The stream type. Only color and depth streams are supported.
*
* @return The list of supported formats (color: OB_FORMAT_RGB; depth: OB_FORMAT_Y10, OB_FORMAT_Y11,
* OB_FORMAT_Y12, OB_FORMAT_Y16, OB_FORMAT_Z16). Empty for unsupported stream types. This is the single
* source of truth used by @ref isSupportedFormat.
*/
static std::vector<OBFormat> getSupportedFormats(OBStreamType streamType) {
if(streamType == OB_STREAM_COLOR) {
return { OB_FORMAT_RGB };
}
if(streamType == OB_STREAM_DEPTH) {
return { OB_FORMAT_Y10, OB_FORMAT_Y11, OB_FORMAT_Y12, OB_FORMAT_Y16, OB_FORMAT_Z16 };
}
return {};
}
/**
* @brief Check whether a resolution is supported by the enhanced depth filter for a given stream alignment pair.
*
* @param[in] sourceStreamType The source stream type that provides the input frames.
* @param[in] alignToStreamType The target stream type that the source stream is aligned to.
* @param[in] width The frame width to validate.
* @param[in] height The frame height to validate.
*
* @return true if the resolution is supported for the specified alignment combination, otherwise false.
*/
static bool isSupportedResolution(OBStreamType sourceStreamType, OBStreamType alignToStreamType, uint32_t width, uint32_t height) {
if(sourceStreamType != alignToStreamType) {
// If the source and target stream types are different, any resolution is supported.
return true;
}
for(const auto &res: getSupportedResolutions()) {
if(res.first == width && res.second == height) {
return true;
}
}
return false;
}
/**
* @brief Check whether a frame format is supported by the enhanced depth filter for a given stream type.
*
* @param[in] streamType The stream type to validate. Only color and depth streams are supported.
* @param[in] format The frame format to validate.
*
* @return true if the format is supported for the given stream type, otherwise false.
*/
static bool isSupportedFormat(OBStreamType streamType, OBFormat format) {
for(const auto &supported: getSupportedFormats(streamType)) {
if(supported == format) {
return true;
}
}
return false;
}
/**
* @brief Set the working resolution of the enhanced depth filter.
*
* @param[in] width The target frame width.
* @param[in] height The target frame height.
*/
void setResolution(uint32_t width, uint32_t height) {
setConfigValue("width", static_cast<double>(width));
setConfigValue("height", static_cast<double>(height));
}
/**
* @brief Get the current configured frame width.
*
* @return uint32_t The current width.
*/
uint32_t getCurrentWidth() const {
return static_cast<uint32_t>(getConfigValue("width"));
}
/**
* @brief Get the current configured frame height.
*
* @return uint32_t The current height.
*/
uint32_t getCurrentHeight() const {
return static_cast<uint32_t>(getConfigValue("height"));
}
/**
* @brief Set the confidence threshold for depth values.
*
* @param value The confidence threshold.
*/
void setConfidenceThreshold(float value) {
setConfigValue("confidence_threshold", value);
}
/**
* @brief Get the property range of the confidence threshold range.
*/
OBFloatPropertyRange getConfidenceThresholdRange() {
OBFloatPropertyRange range{};
const auto &schemaVec = getConfigSchemaVec();
for(const auto &item: schemaVec) {
const char *name = "confidence_threshold";
if(std::strcmp(item.name, name) == 0) {
range = getPropertyRange<OBFloatPropertyRange>(item, getConfigValue(name));
break;
}
}
return range;
}
};
class OBFilterList {
private:
ob_filter_list_t *impl_;
@@ -2151,6 +2311,7 @@ inline const std::unordered_map<std::string, std::type_index> &getFilterTypeMap(
{ "MgcNoiseRemovalFilter", typeid(MgcNoiseRemovalFilter) },
{ "LutNoiseRemovalFilter", typeid(LutNoiseRemovalFilter) },
{ "UnDistortionFilter", typeid(UnDistortionFilter) },
{ "EnhancedDepthFilter", typeid(EnhancedDepthFilter) },
};
return filterTypeMap;
}
@@ -123,6 +123,32 @@ public:
return index;
}
/**
* @brief Get the auth token carried by the frame.
*
* @return uint64_t The auth token value.
*/
uint64_t getToken() const {
ob_error *error = nullptr;
auto token = ob_frame_get_token(impl_, &error);
Error::handle(&error);
return token;
}
/**
* @brief Set the auth token carried by the frame.
*
* @param token The auth token value.
*/
void setToken(uint64_t token) {
ob_error *error = nullptr;
auto unConstImpl = const_cast<ob_frame *>(impl_);
ob_frame_set_token(unConstImpl, token, &error);
Error::handle(&error);
}
/**
* @brief Get frame data
*