0

Rosanswers logo

Dear Experts,

I have been trying to use CameraInfoManager::validateURL function with the following code snippet

camera_info_->setCameraName("my_cam");

if (access(camera_calibration_file_param_.c_str(), F_OK) != -1) { if (camera_info_->validateURL(camera_calibration_file_param_)) { camera_info_->loadCameraInfo(camera_calibration_file_param_); } else { ROS_WARN("Current Camera is Uncalibrated"); } } else { ROS_WARN("Camera Calibration file not found"); }

I have been continuously getting "Current Camera is Uncalibrated" warning. The file is found but some parsing error may be. I have ensured that the EOL for the file is LF.

The following is the content of the calibration yaml file that is passed using camera_calibration_file_param_ object copied verbatim from the file itself.

image_width: 640
image_height: 480
camera_name: "my_cam"
camera_matrix:
  rows: 3
  cols: 3
  data: [968.62926614, 0, 348.38163923, 0, 967.56611892, 252.45327611, 0, 0, 1]
distortion_model: plumb_bob
distortion_coefficients:
  rows: 1
  cols: 5
  data: [-0.02834676, 0.00984921, -0.00135589, 0.00352077, 0.10641544]
rectification_matrix:
  rows: 3
  cols: 3
  data: [1, 0, 0, 0, 1, 0, 0, 0, 1]
projection_matrix:
  rows: 3
  cols: 4
  data: [491.0, 0, 233.0, 0, 0, 564.0, 97.0, 0, 0, 0, 1, 0]

I am unable to find the root cause of this issue. Kindly help

Regards Shouvik


Originally posted by shouvik1984 on ROS Answers with karma: 28 on 2023-03-08

Post score: 0

1 Answers1

0

Rosanswers logo

I found the fix. "file://" needs to be prefixed before the absolute path for validateURL and loadCameraInfo. here is the updated code

camera_info_->setCameraName("my_cam");

if (access(camera_calibration_file_param_.c_str(), F_OK) != -1) { if (camera_info_->validateURL("file://" + camera_calibration_file_param_)) { camera_info_->loadCameraInfo("file://" + camera_calibration_file_param_); } else { ROS_WARN("Current Camera is Uncalibrated"); } } else { ROS_WARN("Camera Calibration file not found"); }


Originally posted by shouvik1984 with karma: 28 on 2023-03-08

This answer was ACCEPTED on the original site

Post score: 0