# Deducing camera_info from cameraMatrix and distortionCoff

Hello All,

I have camera matrix and distortion coefficient matrix from stereolabs zed config file. Now my task is to publish camera_info from these. I don't want to use zed wrapper to publish the camera info. I have used stereoRectify() function of opencv to get R1, R2, P1, P2, and Q matrices. by using this camera info if I run the image_proc to rectify the images from zed I am getting distorted images as show in the below image.

If I use getOptimalCameraMatrix() function to get new camera matrix after rectify and publish this then I am not getting any distortion but the epipolar error got increased.

Can any body point me to right way of doing the conversion?