MCPcopy Create free account
hub / github.com/AiuniAI/Unique3D / do_rotate

Function do_rotate

scripts/utils.py:142–148  ·  view source on GitHub ↗
(rgba_normal, angle)

Source from the content-addressed store, hash-verified

140 return torch.matmul(normal_map.view(-1, 3), R.T).view(normal_map.shape)
141
142def do_rotate(rgba_normal, angle):
143 rgba_normal = torch.from_numpy(rgba_normal).float().cuda() / 255
144 rotated_normal_tensor = rotate_normalmap_by_angle_torch(rgba_normal[..., :3] * 2 - 1, angle)
145 rotated_normal_tensor = (rotated_normal_tensor + 1) / 2
146 rotated_normal_tensor = rotated_normal_tensor * rgba_normal[:, :, [3]] # make bg black
147 rgba_normal_np = torch.cat([rotated_normal_tensor * 255, rgba_normal[:, :, [3]] * 255], dim=-1).cpu().numpy()
148 return rgba_normal_np
149
150def rotate_normals_torch(normal_pils, return_types='np', rotate_direction=1):
151 n_views = len(normal_pils)

Callers 1

rotate_normals_torchFunction · 0.85

Calls 1

Tested by

no test coverage detected