princeton-vl / DROID-SLAM

BSD 3-Clause "New" or "Revised" License
1.66k stars 273 forks source link

Question about the thresholding in proj() #37

Open xwjabc opened 2 years ago

xwjabc commented 2 years ago

The projection function proj() in droid_slam/geom/projective_ops.py (L44) has a threshold for Z. Similar thresholding for Z is also applied in projective_transform() to generate a valid map. I am confused about the the way of thresholding and its aim:

  1. In projective_transform() and proj(), it seems the threshold is used to exclude points too close to camera. However, Z is the third coordinate in the 3D homogenous coordinates, which is not the actual depth. The actual depth should be Z/D. Thus, why does it threshold Z instead of Z/D?
  2. projective_transform() and proj() have different thresholds for Z: MIN_DEPTH and 0.5*MIN_DEPTH respectively. Is there any reason?
  3. I am curious why we should exclude points too close to camera. Is it because if the points are too close, the division might be inaccurate and lead to large error? However, the threshold is not very small (MIN_DEPTH=0.2), which seems too loose for the division stability.
Willyzw commented 2 years ago

Hi, I encounter the same question why the third one of the homogenous coordinates instead of last. Any idea about it??

Btw the replacement for the clamped values are different in py and cuda. Its everywhere replaced with 0.0 e.g. in https://github.com/princeton-vl/DROID-SLAM/blob/92027b31c06f42e4471706bbb46e7eb3cb3a5dd0/src/droid_kernels.cu#L302 in cuda, whereas its clamped to 1.0 in python see https://github.com/princeton-vl/DROID-SLAM/blob/92027b31c06f42e4471706bbb46e7eb3cb3a5dd0/droid_slam/geom/projective_ops.py#L44 This is somehow inconsistent.

Thanks in advance for any input!