ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

validateURL failing even when a proper file is present. [closed]

asked 2023-03-08 06:18:02 -0500

shouvik1984 gravatar image

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

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by shouvik1984
close date 2023-03-15 07:01:35.393495

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-03-08 06:30:49 -0500

shouvik1984 gravatar image

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");
}
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2023-03-08 06:18:02 -0500

Seen: 47 times

Last updated: Mar 08 '23