Ask Your Question
3

What does projection matrix provided by the calibration represent?

asked 2014-01-19 22:15:16 -0500

mateo_7_7 gravatar image

I'm using such a tool from ROS/OpenCV in order to perform the camera calibration. The procedure ends up providing: camera matrix, distortion parameters, rectification matrix and projection matrix. As far as I know the projection matrix contains the intrinsic parameter matrix of the camera multiplied by the extrinsic parameters matrix of the matrix. The extrinsic parameter matrix itself provides the roto-translation of the camera frame with respect to the world frame. If these assumptions are correct...how is the projection matrix computed by Opencv? I,m not defining any world frame!

camera matrix 414.287922 0.000000 382.549277 0.000000 414.306025 230.875006 0.000000 0.000000 1.000000

distortion -0.278237 0.063338 -0.001382 0.000732 0.000000

rectification 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 1.000000

projection 297.051453 0.000000 387.628900 0.000000 0.000000 369.280731 227.051305 0.000000 0.000000 0.000000 1.000000 0.000000

edit retag flag offensive close merge delete

5 Answers

Sort by » oldest newest most voted
4

answered 2014-07-03 07:40:05 -0500

Malefitz gravatar image

updated 2016-11-04 11:32:29 -0500

lucasw gravatar image

The projection matrix P you get is computed by the OpenCV method getOptimalNewCameraMatrix() used in the camera calibration node.

This method is used to control the output of the OpenCV undistortion method initUndistortRectifyMap(). Normally after the remap() some pixels would be outside of your image boundaries and some pixel regions in your image would be invalid (black), depending on the correction of your lens distortion.

The method getOptimalNewCameraMatrix() takes the intrinsic matrix, the distortion coefficients and an alpha value specified by you with:

  • alpha = 1 -> the image is resized so all original pixels fit into the image plane, thus you will most likely get invalid pixels in your undistorted image
  • alpha = 0 -> the image is resized so there are no invalid pixels in the image plane, thus you will most likely lose valid pixels in your undistorted image

This gives you a new camera matrix (called P by the calibration node) that can be passed to initUndistortRectifyMap() which computes the correct remaps depending on your used alpha value.

You can see the differences in this image:

image description

(originally from http://i.imgur.com/bOZ4fKs.jpg )

The left one is with alpha = 0, the right one with alpha = 1 (note that this is not stereo, both images are the same, only "viewed" with a different camera matrix).

The camera calibration node does exactly that, with alpha = 0, and stores the new camera matrix as matrix P in the CameraInfo.

edit flag offensive delete link more
2

answered 2014-04-30 11:35:23 -0500

ssafarik gravatar image

If you are starting with image_raw, then use K and D. If you are starting with image_rect, then use P, with D=[0,0,0,0,0]. In other words, P is like K, but for image_rect.

Steve.

edit flag offensive delete link more
1

answered 2016-11-04 08:01:24 -0500

martin90 gravatar image

The answer can be found here: https://github.com/dimatura/ros_vimdo...

edit flag offensive delete link more
0

answered 2014-04-29 00:02:22 -0500

joanpau gravatar image

The CameraInfo contents are described in the image_pipeline wiki.

The rectification is used in stereo cameras to transform the image planes of a pair of cameras such that the epipolar lines become parallel. The parameters may be computed by the same calibration node, passing a stereo pair instead of a single camera.

When calibrating a monocular camera, as in your case, the rectification is the identity.

edit flag offensive delete link more
0

answered 2014-04-25 05:03:33 -0500

Unfortunately I could not find an answer in the camera calibration page. There is no documentation as far as I see. So, it is dangerous to use it. But, after some investigation I found the following discussion: http://kinect-with-ros.976505.n3.nabb...

I think that this projection is related to the distance between the two cameras of Kinect, but still not very clear to me.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2014-01-19 22:15:16 -0500

Seen: 7,896 times

Last updated: Nov 04 '16