Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SfMPerspectiveCameras projection matrix bug fix (#148)
Summary: Fixed a bug in creating the projection matrix for the SfMPerspectiveCameras class. Also fixed the corresponding test in test_cameras.py. The p0x, p0y are 2D coordinates for the principal point in the NDCS, and therefore should be added AFTER the perspective z divide. I.e. we expect <a href="https://www.codecogs.com/eqnedit.php?latex=\begin{bmatrix}&space;x\&space;y\&space;z&space;\end{bmatrix}_{\text{NDCS}}&space;=&space;\begin{bmatrix}&space;f_xX/Z&space;+&space;p_x\&space;f_yY/Z&space;+&space;p_y\&space;1&space;/&space;Z\&space;\end{bmatrix}&space;=&space;\text{normalize}\left(&space;\begin{bmatrix}&space;f_xX&space;+&space;p_xZ\&space;f_yY&space;+&space;p_yZ\&space;1\&space;Z&space;\end{bmatrix}&space;\right)" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\begin{bmatrix}&space;x\&space;y\&space;z&space;\end{bmatrix}_{\text{NDCS}}&space;=&space;\begin{bmatrix}&space;f_xX/Z&space;+&space;p_x\&space;f_yY/Z&space;+&space;p_y\&space;1&space;/&space;Z\&space;\end{bmatrix}&space;=&space;\text{normalize}\left(&space;\begin{bmatrix}&space;f_xX&space;+&space;p_xZ\&space;f_yY&space;+&space;p_yZ\&space;1\&space;Z&space;\end{bmatrix}&space;\right)" title="\begin{bmatrix} x\ y\ z \end{bmatrix}_{\text{NDCS}} = \begin{bmatrix} f_xX/Z + p_x\ f_yY/Z + p_y\ 1 / Z\ \end{bmatrix} = \text{normalize}\left( \begin{bmatrix} f_xX + p_xZ\ f_yY + p_yZ\ 1\ Z \end{bmatrix} \right)" /></a> The current behavior is <a href="https://www.codecogs.com/eqnedit.php?latex=\begin{bmatrix}&space;x\&space;y\&space;z&space;\end{bmatrix}_{\text{NDCS}}&space;=&space;\begin{bmatrix}&space;f_xX/Z&space;+&space;p_x/Z\&space;f_yY/Z&space;+&space;p_y/Z\&space;1&space;/&space;Z\&space;\end{bmatrix}&space;=&space;\text{normalize}\left(&space;\begin{bmatrix}&space;f_xX&space;+&space;p_x\&space;f_yY&space;+&space;p_y\&space;1\&space;Z&space;\end{bmatrix}&space;\right)" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\begin{bmatrix}&space;x\&space;y\&space;z&space;\end{bmatrix}_{\text{NDCS}}&space;=&space;\begin{bmatrix}&space;f_xX/Z&space;+&space;p_x/Z\&space;f_yY/Z&space;+&space;p_y/Z\&space;1&space;/&space;Z\&space;\end{bmatrix}&space;=&space;\text{normalize}\left(&space;\begin{bmatrix}&space;f_xX&space;+&space;p_x\&space;f_yY&space;+&space;p_y\&space;1\&space;Z&space;\end{bmatrix}&space;\right)" title="\begin{bmatrix} x\ y\ z \end{bmatrix}_{\text{NDCS}} = \begin{bmatrix} f_xX/Z + p_x/Z\ f_yY/Z + p_y/Z\ 1 / Z\ \end{bmatrix} = \text{normalize}\left( \begin{bmatrix} f_xX + p_x\ f_yY + p_y\ 1\ Z \end{bmatrix} \right)" /></a> which is incorrect. Pull Request resolved: #148 Reviewed By: gkioxari Differential Revision: D21039003 Pulled By: davnov134 fbshipit-source-id: 3e19ac22adbcc39b731ae14052a72fd4ddda2af5
- Loading branch information