anqixu / ueye_cam

A ROS nodelet and node that wraps the driver API for UEye cameras by IDS Imaging Development Systems GMBH.
Other
60 stars 102 forks source link

Camera calibration issue #13

Closed rocklinsuv closed 9 years ago

rocklinsuv commented 9 years ago

Hi Anqi,

Me again :D. Recently I realized that I have radial distortion in my UI-1221-LE-M camera, which has to be corrected. I used ros package "camera_calibration", successfully calibrated it and got these params: [image]

width 640

height 480

[narrow_stereo/left]

camera matrix 998.447499 0.000000 299.347092 0.000000 1002.344747 215.660858 0.000000 0.000000 1.000000

distortion -0.572812 0.253845 0.012846 0.008447 0.000000

rectification 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 1.000000

projection 934.325794 0.000000 299.244432 0.000000 0.000000 967.143269 215.957971 0.000000 0.000000 0.000000 1.000000 0.000000

And I also saved them into ~/.ros/camera_info/camera.yaml However, when I launch ueye_cam/mono8.launch and view the images, there seems to be no corrections at all. The images still looked the same. I also tried to modified the [narrow_stereo/left] to [camera] to fit the launch file, but it didn't work. Do you have any idea how to get it working? Besides, I have also tried the "commit" button in "camera_calibration" package, overwrote the file, but didn't work either. Many thanks.

Cheers, Lyn

anqixu commented 9 years ago

Hi Lyn:

The commit button in camera_calibration should automatically save the calibration parameters in .ros/camera_info/.yaml. The camera name is defined in the launch file, and by default should be 'camera'. The fact that your calibration yaml saves as 'narrow_stereo/left' seems to suggest that you had remapped or renamed your camera, in which case the calibration file should be made to match. Also, in the sample ueye_cam launch files, you can explicitly set the location of the calibration parameters file via the parameter 'camera_intrinsics_file'.

Do note that having calibration parameters alone will not rectify your camera images. You will need to have a image_proc/rectify node or nodelet, with proper input topic name mapped, to generate rectified images on a separate topic. See http://wiki.ros.org/image_proc for more information.

P.S.: the latest version of ueye_cam does not have mono8.launch. If you did not create this launch file yourself, then perhaps you have an outdated version of ueye_cam, in which case I'd suggest to pull the latest updates from github.

Cheers;

Anqi

rocklinsuv commented 9 years ago

Thanks Anqi. I took a look at your codes but couldn't find the OpenCV function "undistort". I thought that if we create the camera.yaml file, the driver would automatically adopt the params in that file and undistort the image. So I did my own undistortion in my codes and it is working properly (but pretty slow, 10ms@i7 2600, should have used a look-up table instead).

Cheers, Lyn