The truth is, you dont have to find a value, just find the inverse matrix Q. Let the Opencv handle the rest. since you have D435 means you have stereo and you can perform normal stereo matching and get a list of things.
First
Obtained
Q Matrix
matrix from
stereoRectify(left_cam_matrix, left_dist_coeffs, right_cam_matrix,
right_dist_coeffs,frame_size, stereo_params.R, stereo_params.T, R1,
R2, P1, P2, Q, CALIB_ZERO_DISPARITY, 0, frame_size, 0, 0);
Then obtain depth and color image from stereo matching output.
sgbm->compute(img1, img2, disp);
At least call
C++: void reprojectImageTo3D(InputArray disparity, OutputArray
_3dImage, InputArray Q, bool handleMissingValues=false, int ddepth=-1 )
The 3D pointcloud is in the variable called _3Dimage
If you search for the 3 functions, you will realize that you can find it in the OpenCV directly https://github.com/opencv/opencv/blob/master/samples/cpp/stereo_match.cpp


