Skip to content

Commit 54b482b

Browse files
shapovalovfacebook-github-bot
authored andcommitted
Not normalising control points by X.std()
Summary: davnov134 found that the algorithm crashes if X is an axis-aligned plane. This is because I implemented scaling control points by `X.std()` as a poor man’s version of PCA whitening. I checked that it does not bring consistent improvements, so let’s get rid of it. The algorithm still results in slightly higher errors on the axis aligned planes but at least it does not crash. As a next step, I will experiment with detecting a planar case and using 3-point barycentric coordinates rather than 4-points. Reviewed By: davnov134 Differential Revision: D21179968 fbshipit-source-id: 1f002fce5541934486b51808be0e910324977222
1 parent 9f31a4f commit 54b482b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pytorch3d/ops/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from .knn import knn_gather, knn_points
77
from .mesh_face_areas_normals import mesh_face_areas_normals
88
from .packed_to_padded import packed_to_padded, padded_to_packed
9+
from .perspective_n_points import efficient_pnp
910
from .points_alignment import corresponding_points_alignment, iterative_closest_point
1011
from .points_normals import (
1112
estimate_pointcloud_local_coord_frames,

pytorch3d/ops/perspective_n_points.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@ def _define_control_points(x, weight, storage_opts=None):
3434
"""
3535
storage_opts = storage_opts or {}
3636
x_mean = oputil.wmean(x, weight)
37-
x_std = oputil.wmean((x - x_mean) ** 2, weight) ** 0.5
3837
c_world = F.pad(torch.eye(3, **storage_opts), (0, 0, 0, 1), value=0.0).expand_as(
3938
x[:, :4, :]
4039
)
41-
return c_world * x_std + x_mean
40+
return c_world + x_mean
4241

4342

4443
def _compute_alphas(x, c_world):

0 commit comments

Comments
 (0)