generate normal image
This commit is contained in:
+4
-3
@@ -163,13 +163,14 @@ class DepthRenderer(nn.Module):
|
||||
|
||||
ext = torch.tensor(extrinsic(cam).astype(np.float32), device='cuda')
|
||||
# ext = proj(cam)
|
||||
fp = np.array([240 * (480 / 36), 320 * (640 / 36)], dtype=np.float32)
|
||||
# fp = np.array([240 * (480 / 36), 320 * (640 / 36)], dtype=np.float32)
|
||||
img_size = np.array([480, 640], dtype=np.float32)
|
||||
# K = np.eye(4, dtype=np.float32)
|
||||
# K[:3,:3] = intrinsic()
|
||||
K = torch.tensor(intrinsic()[None, :, :], device='cuda')
|
||||
# cameras = PerspectiveCameras(device='cuda', R=ext[None, :, :3], T=ext[None, :, 3], focal_length=1,)# principal_point=fp[None, :], image_size=img_size[None, :])
|
||||
|
||||
cameras = cameras_from_opencv_projection(R=ext[None, :, :3], tvec=ext[None, :, 3], camera_matrix=torch.tensor(intrinsic()[None, :, :], device='cuda'), image_size=torch.tensor(img_size[None, :], device='cuda'))
|
||||
cameras = cameras_from_opencv_projection(R=ext[None, :, :3], tvec=ext[None, :, 3], camera_matrix=K, image_size=torch.tensor(img_size[None, :], device='cuda'))
|
||||
|
||||
raster_settings = RasterizationSettings(
|
||||
image_size=(480, 640),
|
||||
@@ -197,4 +198,4 @@ class DepthRenderer(nn.Module):
|
||||
# import plotly.express as ex
|
||||
# ex.imshow(depth.cpu().numpy()).show()
|
||||
|
||||
return depth, v2i
|
||||
return depth, mask, v2i, K
|
||||
|
||||
Reference in New Issue
Block a user