Update camera_info data content

This commit is contained in:
jj
2025-06-06 17:17:24 +08:00
parent 928e96f672
commit cc2705c9b0
+13 -21
View File
@@ -738,10 +738,10 @@ void OBCameraNode::setupDevices() {
void OBCameraNode::setupColorPostProcessFilter() { void OBCameraNode::setupColorPostProcessFilter() {
auto color_sensor = device_->getSensor(OB_SENSOR_COLOR); auto color_sensor = device_->getSensor(OB_SENSOR_COLOR);
color_filter_list_ = color_sensor->createRecommendedFilters(); color_filter_list_ = color_sensor->createRecommendedFilters();
if (color_filter_list_.empty()) { if (color_filter_list_.empty()) {
RCLCPP_WARN_STREAM(logger_, "Failed to get color sensor filter list"); RCLCPP_WARN_STREAM(logger_, "Failed to get color sensor filter list");
// return; // return;
} }
for (size_t i = 0; i < color_filter_list_.size(); i++) { for (size_t i = 0; i < color_filter_list_.size(); i++) {
auto filter = color_filter_list_[i]; auto filter = color_filter_list_[i];
std::map<std::string, bool> filter_params = { std::map<std::string, bool> filter_params = {
@@ -2787,24 +2787,16 @@ void OBCameraNode::onNewFrameCallback(const std::shared_ptr<ob::Frame> &frame,
auto pid = device_info->getPid(); auto pid = device_info->getPid();
OBCameraIntrinsic intrinsic; OBCameraIntrinsic intrinsic;
OBCameraDistortion distortion; OBCameraDistortion distortion;
if (isGemini335PID(pid)) { auto stream_profile = frame->getStreamProfile();
auto stream_profile = frame->getStreamProfile(); CHECK_NOTNULL(stream_profile);
CHECK_NOTNULL(stream_profile); auto video_stream_profile = stream_profile->as<ob::VideoStreamProfile>();
auto video_stream_profile = stream_profile->as<ob::VideoStreamProfile>(); CHECK_NOTNULL(video_stream_profile);
CHECK_NOTNULL(video_stream_profile); intrinsic = video_stream_profile->getIntrinsic();
intrinsic = video_stream_profile->getIntrinsic(); distortion = video_stream_profile->getDistortion();
distortion = video_stream_profile->getDistortion(); if (pid == DABAI_MAX_PID) {
} else { // use color param
auto camera_params = pipeline_->getCameraParam(); intrinsic = camera_params.rgbIntrinsic;
intrinsic = stream_index.first == OB_STREAM_COLOR ? camera_params.rgbIntrinsic distortion = camera_params.rgbDistortion;
: camera_params.depthIntrinsic;
distortion = stream_index.first == OB_STREAM_COLOR ? camera_params.rgbDistortion
: camera_params.depthDistortion;
if (pid == DABAI_MAX_PID) {
// use color param
intrinsic = camera_params.rgbIntrinsic;
distortion = camera_params.rgbDistortion;
}
} }
std::string frame_id = optical_frame_id_[stream_index]; std::string frame_id = optical_frame_id_[stream_index];
if (depth_registration_ && stream_index == DEPTH) { if (depth_registration_ && stream_index == DEPTH) {