Skip to content

Commit

Permalink
remove unused params
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangwei221 committed Aug 24, 2022
1 parent 89ab4af commit 758fa46
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
9 changes: 0 additions & 9 deletions geometry/pcd_projector.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@
import torch


def transform_points(points, transformation):
append_ones = np.ones_like(points[:, 0:1])
xyzw = np.concatenate([points, append_ones], axis=1)
xyzw = np.matmul(transformation, xyzw.T).T
xyzw /= xyzw[:, 3:4]
points = xyzw[:, 0:3]
return points


def project_point_cloud_at_capture(point_cloud, capture, render_type='rgb'):
if render_type == 'rgb':
assert point_cloud.shape[1] == 6
Expand Down
15 changes: 3 additions & 12 deletions utils/ray_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ def shot_rays(cap, xys):


def shot_all_rays(cap):
'''
set flip to True when use pretrained weights
'''
c2w = cap.cam_pose.camera_to_world
temp_pcd = PointCloudProjectorNp.img_to_pcd_3d(np.ones(cap.size), cap.intrinsic_matrix, img=None, cam2world=c2w)
dirs = temp_pcd - cap.cam_pose.camera_center_in_world
Expand All @@ -48,18 +45,12 @@ def to_homogeneous(pts):
return np.concatenate([pts, np.ones_like(pts[..., 0:1])], axis=-1)


def warp_samples_to_canonical(pts, verts, faces, T, return_T=False, dist2=None, f_id=None, closest=None, out_cuda=False):
if dist2 is None:
dist2, f_id, closest = igl.point_mesh_squared_distance(pts, verts, faces[:, :3])
def warp_samples_to_canonical(pts, verts, faces, T):
dist2, f_id, closest = igl.point_mesh_squared_distance(pts, verts, faces[:, :3])
closest_tri = verts[faces[:, :3][f_id]]
barycentric = igl.barycentric_coordinates_tri(closest, closest_tri[:, 0, :].copy(), closest_tri[:, 1, :].copy(), closest_tri[:, 2, :].copy())
T_interp = (T[faces[:, :3][f_id]] * barycentric[..., None, None]).sum(axis=1)
if out_cuda:
T_interp_inv = torch.inverse(torch.from_numpy(T_interp).float().to('cuda'))
else:
T_interp_inv = np.linalg.inv(T_interp)
if return_T:
return T_interp_inv, f_id, dist2
T_interp_inv = np.linalg.inv(T_interp)
new_pts = (T_interp_inv @ to_homogeneous(pts)[..., None])[:, :3, 0]
new_dirs = new_pts[1:] - new_pts[:-1]
new_dirs = np.concatenate([new_dirs, new_dirs[-1:]])
Expand Down

0 comments on commit 758fa46

Please sign in to comment.