ros-drivers / pointgrey_camera_driver

ROS driver for Pt. Grey cameras, based on the official FlyCapture2 SDK.
128 stars 179 forks source link

Can't calibrate when camera is configured to transmit ROI #71

Open keithicus opened 8 years ago

keithicus commented 8 years ago

I'm working with a fisheye lens and need to crop the image and perform calibration. I set the camera ROI in my launch file as follows:

  <param name="format7_x_offset" value="700" />
  <param name="format7_roi_width" value="1100" />
  <param name="format7_y_offset" value="450" />
  <param name="format7_roi_height" value="1100" />

I was able to follow and perform image calibration with the image_proc package as outlined here:

http://wiki.ros.org/camera_calibration/Tutorials/MonocularCalibration

The yaml file i created had the dimensions of the ROI (1100x1100). When I tried to use this calibration file with this package, i ran into the following error:

OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file /Users/artemlenskiy/ros/hydro/src/opencv2/modules/core/src/matrix.cpp, line 323 OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file /Users/artemlenskiy/ros/hydro/src/opencv2/modules/core/src/matrix.cpp, line 323

I believe the issue I'm running into is something similar to this:

https://github.com/ros-drivers/camera1394/issues/36

As a work around, I abandoned image_proc for rectification and instead used this package:

https://github.com/team-vigir/vigir_wide_angle_image_proc

Which uses this matlab toolbox to calculate the calibration:

https://sites.google.com/site/scarabotix/ocamcalib-toolbox

Not sure what can be done so that a calibrated ROI could be used.