fix: remove cursed open3d code

This commit is contained in:
Laurent FAINSIN 2023-04-06 09:27:46 +02:00
parent 32d37792c7
commit 0ff2e1d30f
3 changed files with 0 additions and 68 deletions

View file

@ -4,7 +4,6 @@ import numpy as np
from torch.utils.data import Dataset from torch.utils.data import Dataset
from torch.utils import data from torch.utils import data
import random import random
import open3d as o3d
import numpy as np import numpy as np
import torch.nn.functional as F import torch.nn.functional as F
@ -234,34 +233,6 @@ class ShapeNet15kPointClouds(Uniform15KPC):
class PointCloudMasks(object):
'''
render a view then save mask
'''
def __init__(self, radius : float=10, elev: float =45, azim:float=315, ):
self.radius = radius
self.elev = elev
self.azim = azim
def __call__(self, points):
pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(points)
camera = [self.radius * np.sin(90-self.elev) * np.cos(self.azim),
self.radius * np.cos(90 - self.elev),
self.radius * np.sin(90 - self.elev) * np.sin(self.azim),
]
# camera = [0,self.radius,0]
_, pt_map = pcd.hidden_point_removal(camera, self.radius)
mask = torch.zeros_like(points)
mask[pt_map] = 1
return mask #points[pt_map]
#################################################################################### ####################################################################################

View file

@ -2,7 +2,6 @@ import warnings
from torch.utils.data import Dataset from torch.utils.data import Dataset
from tqdm import tqdm from tqdm import tqdm
from pathlib import Path from pathlib import Path
import open3d as o3d
import os import os
import numpy as np import numpy as np
@ -219,39 +218,3 @@ class ShapeNet_Multiview_Points(Dataset):
return data return data
class DepthToSingleViewPoints(object):
'''
render a view then save mask
'''
def __init__(self, cam_ext, cam_int):
self.cam_ext = cam_ext.reshape(4,4)
self.cam_int = cam_int.reshape(3,3)
def __call__(self, depth_pth, depth_minmax_pth):
depth_minmax = np.load(depth_minmax_pth)
depth_img = plt.imread(depth_pth)[...,0]
mask = np.where(depth_img == 0, -1.0, 1.0)
depth_img = 1 - depth_img
depth_img = (depth_img * (np.max(depth_minmax) - np.min(depth_minmax)) + np.min(depth_minmax)) * mask
intr = o3d.camera.PinholeCameraIntrinsic(depth_img.shape[0], depth_img.shape[1],
self.cam_int[0, 0], self.cam_int[1, 1], self.cam_int[0,2],
self.cam_int[1,2])
depth_im = o3d.geometry.Image(depth_img.astype(np.float32, copy=False))
# rgbd_im = o3d.geometry.RGBDImage.create_from_color_and_depth(color_im, depth_im)
pcd = o3d.geometry.PointCloud.create_from_depth_image(depth_im, intr, self.cam_ext, depth_scale=1.)
pc = np.asarray(pcd.points)
return pc, depth_img
def __repr__(self):
return 'MeshToMaskedVoxel_'+str(self.radius)+str(self.resolution)+str(self.elev )+str(self.azim)+str(self.img_size )

View file

@ -7,7 +7,6 @@ channels:
- nvidia - nvidia
- conda-forge - conda-forge
- pyg - pyg
- open3d-admin
dependencies: dependencies:
- python - python
@ -15,7 +14,6 @@ dependencies:
- torchvision - torchvision
- cudatoolkit - cudatoolkit
- matplotlib - matplotlib
- open3d
- tqdm - tqdm
- trimesh - trimesh
- scipy - scipy