title: 3D from camera matrix, disparity and extrinsic
body: <p>I am trying to recover distance from an <strong>inverse</strong> disparity map, the camera matrix and some extrinsic parameters. I know that the cameras are 54cm apart. I wrote this code based on <a href="https://dellaert.github.io/19F-4476/proj3.html" rel="nofollow noreferrer">https://dellaert.github.io/19F-4476/proj3.html</a>. The cameras are parallel so I believe the rotation matrix should be an identity matrix? Also, how should I change my code if I have an <strong>inverse</strong> disparity map instead of a normal disparity map?</p>
  <pre><code>import numpy as np
  
  # (u,v,depth)
  depth_point = np.array([[50], [50], [2], [1]])
  
  #cemera matrix
  K = np.array([[721, 0, 596],
                [0, 721, 149],
                [0, 0, 1]])
  
  R = np.eye(3)
  
  # Cameras are 54 cm apart
  T = np.c_[np.eye(3),[-0.54,0,0]]
  
  # Do the projection
  point3d = np.dot(np.dot(np.dot(K, R), T), depth_point)
  </code></pre>