Update the name of the distortion model in camera_info

This commit is contained in:
jj
2025-03-31 13:40:28 +08:00
parent b5dcada17b
commit 8665737267
3 changed files with 27 additions and 1 deletions
@@ -193,4 +193,5 @@ OBStreamType obStreamTypeFromString(const std::string& stream_type);
cv::Mat undistortImage(const cv::Mat& image, const OBCameraIntrinsic& intrinsic,
const OBCameraDistortion& distortion);
std::string getDistortionModels(OBCameraDistortion distortion);
} // namespace orbbec_camera
@@ -135,6 +135,12 @@ def generate_launch_description():
DeclareLaunchArgument('tf_publish_rate', default_value='0.0'),
DeclareLaunchArgument('ir_info_url', default_value=''),
DeclareLaunchArgument('color_info_url', default_value=''),
# Network device settings: default enumerate_net_device is set to true, which will automatically enumerate network devices
# If you do not want to automatically enumerate network devices,
# you can set enumerate_net_device to false, net_device_ip to the device's IP address, and net_device_port to the default value of 8090
DeclareLaunchArgument("enumerate_net_device", default_value="false"),
DeclareLaunchArgument("net_device_ip", default_value=""),
DeclareLaunchArgument("net_device_port", default_value="0"),
DeclareLaunchArgument('log_level', default_value='none'),
DeclareLaunchArgument('enable_publish_extrinsic', default_value='false'),
DeclareLaunchArgument('enable_d2c_viewer', default_value='false'),
+20 -1
View File
@@ -23,7 +23,7 @@ sensor_msgs::msg::CameraInfo convertToCameraInfo(OBCameraIntrinsic intrinsic,
OBCameraDistortion distortion, int width) {
(void)width;
sensor_msgs::msg::CameraInfo info;
info.distortion_model = sensor_msgs::distortion_models::RATIONAL_POLYNOMIAL;
info.distortion_model = getDistortionModels(distortion);
info.width = intrinsic.width;
info.height = intrinsic.height;
info.d.resize(8, 0.0);
@@ -897,4 +897,23 @@ cv::Mat undistortImage(const cv::Mat &image, const OBCameraIntrinsic &intrinsic,
return undistorted_image;
}
std::string getDistortionModels(OBCameraDistortion distortion){
switch (distortion.model)
{
case OB_DISTORTION_NONE:
return "ob_distortion_none";
case OB_DISTORTION_MODIFIED_BROWN_CONRADY:
return "ob_distortion_modified_brown_conrady";
case OB_DISTORTION_INVERSE_BROWN_CONRADY:
return "ob_distortion_inverse_brown_conrady";
case OB_DISTORTION_BROWN_CONRADY:
return "ob_distortion_brown_conrady";
case OB_DISTORTION_BROWN_CONRADY_K6:
return "ob_distortion_brown_conrady_k6";
case OB_DISTORTION_KANNALA_BRANDT4:
return "ob_distortion_kannala_brandt4";
default:
return "unknown_field";
}
}
} // namespace orbbec_camera