update OrbbecSDK version to 2.8.8

This commit is contained in:
ob-yalian
2026-06-02 10:44:53 +08:00
parent c1bf09c09b
commit b9c3bfd627
12 changed files with 162 additions and 69 deletions
@@ -484,26 +484,6 @@ public:
/**
* @brief UnDistortionFilter removes lens distortion from a chosen stream (Color, IR, or Depth).
*
* Usage (pure color undistortion, sync_align scenario):
* @code
* auto filter = std::make_shared<ob::UnDistortionFilter>();
* // default stream type is COLOR, default mode is pure undistortion
* filter->pushFrame(frameSet);
* @endcode
*
* Usage (virtual-camera mode, hw_d2c_align scenario):
* @code
* auto filter = std::make_shared<ob::UnDistortionFilter>();
* // Pass the raw depth intrinsic — filter computes the scale to color resolution internally.
* filter->setNewCameraMatrix(depthIntrinsic);
* filter->pushFrame(frameSet);
* @endcode
*
* Usage (depth undistortion — must use nearest-neighbor interpolation):
* @code
* auto filter = std::make_shared<ob::UnDistortionFilter>(OB_STREAM_DEPTH);
* filter->setInterpolationMode(0); // nearest neighbor avoids ghost-depth artefacts
* @endcode
*/
class UnDistortionFilter : public Filter {
public:
@@ -519,7 +499,6 @@ public:
/**
* @brief Set which stream to undistort (default: OB_STREAM_COLOR).
* For depth streams, also call setInterpolationMode(0).
*/
void setStreamType(OBStreamType streamType) {
setConfigValue("StreamType", static_cast<double>(streamType));
@@ -544,11 +523,11 @@ public:
* @param depthIntrinsic The depth camera intrinsic at its native resolution.
*/
void setNewCameraMatrix(OBCameraIntrinsic depthIntrinsic) {
setConfigValue("NewCameraFx", static_cast<double>(depthIntrinsic.fx));
setConfigValue("NewCameraFy", static_cast<double>(depthIntrinsic.fy));
setConfigValue("NewCameraCx", static_cast<double>(depthIntrinsic.cx));
setConfigValue("NewCameraCy", static_cast<double>(depthIntrinsic.cy));
setConfigValue("NewCameraWidth", static_cast<double>(depthIntrinsic.width));
setConfigValue("NewCameraFx", static_cast<double>(depthIntrinsic.fx));
setConfigValue("NewCameraFy", static_cast<double>(depthIntrinsic.fy));
setConfigValue("NewCameraCx", static_cast<double>(depthIntrinsic.cx));
setConfigValue("NewCameraCy", static_cast<double>(depthIntrinsic.cy));
setConfigValue("NewCameraWidth", static_cast<double>(depthIntrinsic.width));
setConfigValue("NewCameraHeight", static_cast<double>(depthIntrinsic.height));
}
@@ -558,18 +537,6 @@ public:
void clearNewCameraMatrix() {
setConfigValue("NewCameraWidth", 0.0);
}
/**
* @brief Set the pixel interpolation mode.
* @param mode 0 = nearest-neighbor (required for depth), 1 = bilinear (default).
*/
void setInterpolationMode(int mode) {
setConfigValue("InterpolationMode", static_cast<double>(mode));
}
int getInterpolationMode() const {
return static_cast<int>(getConfigValue("InterpolationMode"));
}
};
/**
@@ -1232,7 +1199,7 @@ public:
*/
OBUint16PropertyRange getMarginXthRange() {
OBUint16PropertyRange range{};
const auto & schemaVec = getConfigSchemaVec();
const auto &schemaVec = getConfigSchemaVec();
for(const auto &item: schemaVec) {
if(strcmp(item.name, "margin_x_th") == 0) {
range = getPropertyRange<OBUint16PropertyRange>(item, getConfigValue("margin_x_th"));
@@ -1248,7 +1215,7 @@ public:
*/
OBUint16PropertyRange getMarginYthRange() {
OBUint16PropertyRange range{};
const auto & schemaVec = getConfigSchemaVec();
const auto &schemaVec = getConfigSchemaVec();
for(const auto &item: schemaVec) {
if(strcmp(item.name, "margin_y_th") == 0) {
range = getPropertyRange<OBUint16PropertyRange>(item, getConfigValue("margin_y_th"));
@@ -1264,7 +1231,7 @@ public:
*/
OBUint16PropertyRange getLimitXthRange() {
OBUint16PropertyRange range{};
const auto & schemaVec = getConfigSchemaVec();
const auto &schemaVec = getConfigSchemaVec();
for(const auto &item: schemaVec) {
if(strcmp(item.name, "limit_x_th") == 0) {
range = getPropertyRange<OBUint16PropertyRange>(item, getConfigValue("limit_x_th"));
@@ -1280,7 +1247,7 @@ public:
*/
OBUint16PropertyRange getLimitYthRange() {
OBUint16PropertyRange range{};
const auto & schemaVec = getConfigSchemaVec();
const auto &schemaVec = getConfigSchemaVec();
for(const auto &item: schemaVec) {
if(strcmp(item.name, "limit_y_th") == 0) {
range = getPropertyRange<OBUint16PropertyRange>(item, getConfigValue("limit_y_th"));
@@ -1296,7 +1263,7 @@ public:
*/
OBUint16PropertyRange getVerticalDirectionEnableRange() {
OBUint16PropertyRange range{};
const auto & schemaVec = getConfigSchemaVec();
const auto &schemaVec = getConfigSchemaVec();
for(const auto &item: schemaVec) {
if(strcmp(item.name, "enable_vertical_direction") == 0) {
range = getPropertyRange<OBUint16PropertyRange>(item, getConfigValue("enable_vertical_direction"));
@@ -1312,7 +1279,7 @@ public:
*/
OBUint16PropertyRange getWidthRange() {
OBUint16PropertyRange range{};
const auto & schemaVec = getConfigSchemaVec();
const auto &schemaVec = getConfigSchemaVec();
for(const auto &item: schemaVec) {
if(strcmp(item.name, "width") == 0) {
range = getPropertyRange<OBUint16PropertyRange>(item, getConfigValue("width"));
@@ -1328,7 +1295,7 @@ public:
*/
OBUint16PropertyRange getHeightRange() {
OBUint16PropertyRange range{};
const auto & schemaVec = getConfigSchemaVec();
const auto &schemaVec = getConfigSchemaVec();
for(const auto &item: schemaVec) {
if(strcmp(item.name, "height") == 0) {
range = getPropertyRange<OBUint16PropertyRange>(item, getConfigValue("height"));
@@ -1369,7 +1336,6 @@ public:
param.height = static_cast<uint16_t>(getConfigValue("height"));
return param;
}
};
/**
@@ -2166,13 +2132,20 @@ public:
*/
inline const std::unordered_map<std::string, std::type_index> &getFilterTypeMap() {
static const std::unordered_map<std::string, std::type_index> filterTypeMap = {
{ "PointCloudFilter", typeid(PointCloudFilter) }, { "Align", typeid(Align) },
{ "FormatConverter", typeid(FormatConvertFilter) }, { "HDRMerge", typeid(HdrMerge) },
{ "SequenceIdFilter", typeid(SequenceIdFilter) }, { "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) },
{ "PointCloudFilter", typeid(PointCloudFilter) },
{ "Align", typeid(Align) },
{ "FormatConverter", typeid(FormatConvertFilter) },
{ "HDRMerge", typeid(HdrMerge) },
{ "SequenceIdFilter", typeid(SequenceIdFilter) },
{ "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) },
{ "EdgeNoiseRemovalFilter", typeid(EdgeNoiseRemovalFilter) },
{ "FalsePositiveFilter", typeid(FalsePositiveFilter) },
{ "MgcNoiseRemovalFilter", typeid(MgcNoiseRemovalFilter) },
@@ -68,6 +68,28 @@ public:
return ob_imu_rate_type_to_string(type);
}
/**
* @brief Convert OBIMUSampleRate to its numeric frequency value in Hz.
*
* @param[in] type OBIMUSampleRate type.
*
* @return IMU sample rate value in Hz.
*/
static float convertOBIMUSampleRateTypeToValue(const OBIMUSampleRate &type) {
return ob_imu_rate_type_to_value(type);
}
/**
* @brief Convert a numeric IMU sample rate value in Hz to OBIMUSampleRate.
*
* @param[in] value IMU sample rate value in Hz.
*
* @return Matching OBIMUSampleRate.
*/
static OBIMUSampleRate convertOBIMUSampleRateValueToType(float value) {
return ob_imu_rate_value_to_type(value);
}
/**
* @brief Convert OBGyroFullScaleRange to " string " type and then return.
*
@@ -122,6 +144,50 @@ public:
return ob_sensor_type_to_stream_type(type);
}
/**
* @brief Convert OBStreamType to OBSensorType and then return.
*
* @param[in] type OBStreamType type.
*
* @return OBSensorType type.
*/
static OBSensorType convertStreamTypeToSensorType(OBStreamType type) {
return ob_stream_type_to_sensor_type(type);
}
/**
* @brief Convert OBStreamType to OBFrameType and then return.
*
* @param[in] type OBStreamType type.
*
* @return OBFrameType type.
*/
static OBFrameType convertStreamTypeToFrameType(OBStreamType type) {
return ob_stream_type_to_frame_type(type);
}
/**
* @brief Convert OBFrameType to OBStreamType and then return.
*
* @param[in] type OBFrameType type.
*
* @return OBStreamType type.
*/
static OBStreamType convertFrameTypeToStreamType(OBFrameType type) {
return ob_frame_type_to_stream_type(type);
}
/**
* @brief Convert OBFrameType to OBSensorType and then return.
*
* @param[in] type OBFrameType type.
*
* @return OBSensorType type.
*/
static OBSensorType convertFrameTypeToSensorType(OBFrameType type) {
return ob_frame_type_to_sensor_type(type);
}
/**
* @brief Check if the given sensor type is a video sensor.
* @brief Video sensors are sensors that produce video frames.