Correspondence between the index of pcl and disparity

I would like to know the correspondence between the index of the point cloud calculated by reprojectImageTo3d and the index of the disparity image, which is the input image.

I have used reprojectImageTo3d to generate a point cloud using a disparity image generated from stereo matching and a Q-matrix with pre-calibration parameters.
And it seems to be working well.
Furthermore, the contour is extracted from the disparity image and the masked RGB image, and the center point of the contour is obtained in image coordinates.
I want to get the point cloud corresponding to the image coordinate (index), but the index (u, v) of the image coordinate and the index i of the point cloud cannot be mapped.

Specifically, the index of the image coordinate cannot be applied to the index of the point cloud, so it is assumed to be the index when it is stored in the 1d array as shown below.

i = (row * len(row)) + col

Using the above index, I tried to get the corresponding point cloud, but it was different from the index of the point cloud.
I believe this is theoretically correct, but is there anything wrong with it?

it’s the same, because both still have 2D shape, with 2-channel or 3-channel points.

don’t use linear indices.

“point cloud” refers to a collection of points, not to single points.

Does that mean there is no way to get the corresponding point in the image by judging the RGB values, etc.?

impossible to answer. question needs more context.