Skip to content

Commit

Permalink
Update orbbecsdk library to v1.9.3
Browse files Browse the repository at this point in the history
  • Loading branch information
lixby03 committed Jan 15, 2024
1 parent 1604874 commit 78535f2
Show file tree
Hide file tree
Showing 11 changed files with 134 additions and 27 deletions.
30 changes: 19 additions & 11 deletions orbbec_camera/SDK/include/libobsensor/h/ObTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ typedef struct {
* @brief calibration parameters
*/
typedef struct {
OBCameraIntrinsic intrinsics[OB_SENSOR_COUNT]; ///< Sensor internal parameters
OBCameraIntrinsic intrinsics[OB_SENSOR_COUNT]; ///< Sensor internal parameters
OBCameraDistortion distortion[OB_SENSOR_COUNT]; ///< Sensor distortion
OBTransform extrinsics[OB_SENSOR_COUNT][OB_SENSOR_COUNT]; ///< The extrinsic parameters allow 3D coordinate conversions between sensor.To transform from a
///< source to a target 3D coordinate system,under extrinsics[source][target].
} OBCalibrationParam, ob_calibration_param;
Expand All @@ -418,18 +419,18 @@ typedef struct {

/**
* @brief Configuration for mgc filter
*/
typedef struct{
*/
typedef struct {
uint32_t width;
uint32_t height;
int max_width_left;
int max_width_right;
int max_radius;
int margin_x_th;
int margin_y_th;
int limit_x_th;
int limit_y_th;
}OBMGCFilterConfig,ob_mgc_filter_config;
int max_width_left;
int max_width_right;
int max_radius;
int margin_x_th;
int margin_y_th;
int limit_x_th;
int limit_y_th;
} OBMGCFilterConfig, ob_mgc_filter_config;

/**
* @brief Alignment mode
Expand Down Expand Up @@ -654,6 +655,13 @@ typedef struct {
float y; ///< Y coordinate
} OBPoint2f, ob_point2f;

typedef struct {
float *xTable; ///< table used to compute X coordinate
float *yTable; ///< table used to compute Y coordinate
int width; ///< width of x and y tables
int height; ///< height of x and y tables
} OBXYTables, ob_xy_tables;

/**
* @brief 3D point structure with color information
*/
Expand Down
63 changes: 59 additions & 4 deletions orbbec_camera/SDK/include/libobsensor/h/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ extern "C" {
*
* @param[in] calibration_param Device calibration param,see pipeline::getCalibrationParam
* @param[in] source_point3f Source 3d point value
* @param[in] source_sensor_Type Source sensor type
* @param[in] source_sensor_type Source sensor type
* @param[in] target_sensor_type Target sensor type
* @param[out] target_point3f Target 3d point value
* @param[out] error Log error messages
*
* @return bool Transform result
*/
bool ob_calibration_3d_to_3d(const ob_calibration_param calibration_param, const ob_point3f source_point3f, const ob_sensor_type source_sensor_Type,
bool ob_calibration_3d_to_3d(const ob_calibration_param calibration_param, const ob_point3f source_point3f, const ob_sensor_type source_sensor_type,
const ob_sensor_type target_sensor_type, ob_point3f *target_point3f, ob_error **error);

/**
Expand All @@ -28,14 +28,31 @@ bool ob_calibration_3d_to_3d(const ob_calibration_param calibration_param, const
* @param[in] source_point2f Source 2d point value
* @param[in] source_depth_pixel_value The depth of sourcePoint2f in millimeters
* @param[in] source_sensor_type Source sensor type
* @param[in] target_sensor_Type Target sensor type
* @param[in] target_sensor_type Target sensor type
* @param[out] target_point3f Target 3d point value
* @param[out] error Log error messages
*
* @return bool Transform result
*/
bool ob_calibration_2d_to_3d(const ob_calibration_param calibration_param, const ob_point2f source_point2f, const float source_depth_pixel_value,
const ob_sensor_type source_sensor_type, const ob_sensor_type target_sensor_Type, ob_point3f *target_point3f, ob_error **error);
const ob_sensor_type source_sensor_type, const ob_sensor_type target_sensor_type, ob_point3f *target_point3f, ob_error **error);

/**
* @brief Transform a 2d pixel coordinate with an associated depth value of the source camera into a 3d point of the target coordinate system.
*
* @param[in] calibration_param Device calibration param,see pipeline::getCalibrationParam
* @param[in] source_point2f Source 2d point value
* @param[in] source_depth_pixel_value The depth of sourcePoint2f in millimeters
* @param[in] source_sensor_type Source sensor type
* @param[in] target_sensor_type Target sensor type
* @param[out] target_point3f Target 3d point value
* @param[out] error Log error messages
*
* @return bool Transform result
*/
bool ob_calibration_2d_to_3d_undistortion(const ob_calibration_param calibration_param, const ob_point2f source_point2f, const float source_depth_pixel_value,
const ob_sensor_type source_sensor_type, const ob_sensor_type target_sensor_type, ob_point3f *target_point3f,
ob_error **error);

/**
* @brief Transform a 3d point of a source coordinate system into a 2d pixel coordinate of the target camera.
Expand Down Expand Up @@ -82,6 +99,44 @@ bool ob_calibration_2d_to_2d(const ob_calibration_param calibration_param, const
ob_frame *transformation_depth_frame_to_color_camera(ob_device *device, ob_frame *depth_frame, uint32_t target_color_camera_width,
uint32_t target_color_camera_height, ob_error **error);

/**
* @brief Init transformation tables
*
* @param[in] calibration_param Device calibration param,see pipeline::getCalibrationParam
* @param[in] sensor_type sensor type
* @param[in] data input data,needs to be allocated externally.During initialization, the external allocation size is 'data_size', for example, data_size = 1920
* * 1080 * 2*sizeof(float) (1920 * 1080 represents the image resolution, and 2 represents two LUTs, one for x-coordinate and one for y-coordinate).
* @param[in] data_size input data size
* @param[out] xy_tables output xy tables
* @param[out] error Log error messages
*
* @return bool Transform result
*/
bool transformation_init_xy_tables(const ob_calibration_param calibration_param, const ob_sensor_type sensor_type, float *data, uint32_t *data_size,
ob_xy_tables *xy_tables, ob_error **error);

/**
* @brief Transform depth image to point cloud data
*
* @param[in] xy_tables input xy tables,see transformation_init_xy_tables
* @param[in] depth_image_data input depth image data
* @param[out] pointcloud_data output point cloud data
* @param[out] error Log error messages
*/
void transformation_depth_to_pointcloud(ob_xy_tables *xy_tables, const void *depth_image_data, void *pointcloud_data, ob_error **error);

/**
* @brief Transform depth image to point cloud data
*
* @param[in] xy_tables input xy tables,see transformation_init_xy_tables
* @param[in] depth_image_data input depth image data
* @param[in] color_image_data input color image data (only RGB888 support)
* @param[out] pointcloud_data output point cloud data
* @param[out] error Log error messages
*/
void transformation_depth_to_rgbd_pointcloud(ob_xy_tables *xy_tables, const void *depth_image_data, const void *color_image_data, void *pointcloud_data,
ob_error **error);

#ifdef __cplusplus
}
#endif
2 changes: 1 addition & 1 deletion orbbec_camera/SDK/include/libobsensor/hpp/Pipeline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ class OB_EXTENSION_API Config {
* @brief The processing strategy when the FrameSet generated by the frame aggregation function does not contain the frames of all opened streams (which
* can be caused by different frame rates of each stream, or by the loss of frames of one stream): drop directly or output to the user.
*
* @param mode The frame aggregation output mode to be set (default mode is @ref OB_FRAME_AGGREGATE_OUTPUT_FULL_FRAME_REQUIRE)
* @param mode The frame aggregation output mode to be set (default mode is @ref OB_FRAME_AGGREGATE_OUTPUT_ANY_SITUATION)
*/
void setFrameAggregateOutputMode(OBFrameAggregateOutputMode mode);

Expand Down
52 changes: 52 additions & 0 deletions orbbec_camera/SDK/include/libobsensor/hpp/Utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ class OB_EXTENSION_API CoordinateTransformHelper {
static bool calibration2dTo3d(const OBCalibrationParam calibrationParam, const OBPoint2f sourcePoint2f, const float sourceDepthPixelValue,
const OBSensorType sourceSensorType, const OBSensorType targetSensorType, OBPoint3f *targetPoint3f);

/**
* @brief Transform a 2d pixel coordinate with an associated depth value of the source camera into a 3d point of the target coordinate system.
* @brief This function uses undistortion, which may result in longer processing time.
*
* @param calibrationParam Device calibration param,see pipeline::getCalibrationParam
* @param sourcePoint2f Source 2d point value
* @param sourceDepthPixelValue The depth of sourcePoint2f in millimeters
* @param sourceSensorType Source sensor type
* @param targetSensorType Target sensor type
* @param targetPoint3f Target 3d point value
*
* @return bool Transform result
*/
static bool calibration2dTo3dUndistortion(const OBCalibrationParam calibrationParam, const OBPoint2f sourcePoint2f, const float sourceDepthPixelValue,
const OBSensorType sourceSensorType, const OBSensorType targetSensorType, OBPoint3f *targetPoint3f);

/**
* @brief Transform a 3d point of a source coordinate system into a 2d pixel coordinate of the target camera.
*
Expand Down Expand Up @@ -82,5 +98,41 @@ class OB_EXTENSION_API CoordinateTransformHelper {
*/
static std::shared_ptr<ob::Frame> transformationDepthFrameToColorCamera(std::shared_ptr<ob::Device> device, std::shared_ptr<ob::Frame> depthFrame,
uint32_t targetColorCameraWidth, uint32_t targetColorCameraHeight);

/**
* @brief Init transformation tables
*
* @param calibrationParam Device calibration param,see pipeline::getCalibrationParam
* @param sensorType sensor type
* @param data input data,needs to be allocated externally.During initialization, the external allocation size is 'dataSize', for example, dataSize = 1920 *
* 1080 * 2*sizeof(float) (1920 * 1080 represents the image resolution, and 2 represents two LUTs, one for x-coordinate and one for y-coordinate).
* @param dataSize input data size
* @param xyTables output xy tables
*
* @return bool Transform result
*/
static bool transformationInitXYTables(const OBCalibrationParam calibrationParam, const OBSensorType sensorType, float *data, uint32_t *dataSize,
OBXYTables *xyTables);

/**
* @brief Transform depth image to point cloud data
*
* @param xyTables input xy tables,see CoordinateTransformHelper::transformationInitXYTables
* @param depthImageData input depth image data
* @param pointCloudData output point cloud data
*
*/
static void transformationDepthToPointCloud(OBXYTables *xyTables, const void *depthImageData, void *pointCloudData);

/**
* @brief Transform depth image to RGBD point cloud data
*
* @param xyTables input xy tables,see CoordinateTransformHelper::transformationInitXYTables
* @param depthImageData input depth image data
* @param colorImageData input color image data (only RGB888 support)
* @param pointCloudData output RGBD point cloud data
*
*/
static void transformationDepthToRGBDPointCloud(OBXYTables *xyTables, const void *depthImageData, const void *colorImageData, void *pointCloudData);
};
} // namespace ob
2 changes: 1 addition & 1 deletion orbbec_camera/SDK/lib/arm32/libOrbbecSDK.so.1.9
Binary file not shown.
2 changes: 1 addition & 1 deletion orbbec_camera/SDK/lib/arm64/libOrbbecSDK.so.1.9
Binary file not shown.
2 changes: 1 addition & 1 deletion orbbec_camera/SDK/lib/x64/libOrbbecSDK.so.1.9
Binary file not shown.
8 changes: 0 additions & 8 deletions orbbec_camera/src/ob_camera_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1428,14 +1428,6 @@ void OBCameraNode::calcAndPublishStaticTransform() {
publishStaticTF(tf_timestamp, zero_trans, quaternion_optical, frame_id_[stream_index],
optical_frame_id_[stream_index]);
}
// for (const auto &stream_index : HID_STREAMS) {
// if (enable_stream_[stream_index]) {
// publishStaticTF(tf_timestamp, zero_trans, zero_rot, camera_link_frame_id_,
// frame_id_[stream_index]);
// publishStaticTF(tf_timestamp, zero_trans, quaternion_optical, frame_id_[stream_index],
// optical_frame_id_[stream_index]);
// }
// }
publishStaticTF(tf_timestamp, zero_trans, zero_rot, camera_link_frame_id_, imu_frame_id_);
publishStaticTF(tf_timestamp, zero_trans, quaternion_optical, imu_frame_id_, imu_optical_frame_id_);
}
Expand Down

0 comments on commit 78535f2

Please sign in to comment.