# converting DisparityImage message to PointCloud2

Hi,

I want to convert a `DisparityImage`

message to a `PointCloud2`

messages such that each pixel disparity value is now a x, y, z value of a point in space. The other information that comes as part of the `DisparityImage`

message are the focal length, max disparity and baseline. I know how to calculate the z value using them but I'm not sure what the equation is for x and y?

I was looking at this opencv function `reprojectImageTo3D()`

but that needs the `Q`

perspective transformation matrix. How should I calculate that?

Thank you