jens commited on
Commit
8efff47
·
1 Parent(s): ba4f873
Files changed (1) hide show
  1. inference.py +5 -2
inference.py CHANGED
@@ -37,13 +37,16 @@ def PCL(mask, depth):
37
  assert type(depth) == np.ndarray
38
  rgb_mask = np.zeros((mask.shape[0], mask.shape[1], 3)).astype("uint8")
39
  rgb_mask[mask] = (255, 0, 0)
40
- print(mask.sum())
41
  depth_o3d = o3d.geometry.Image(depth)
42
  image_o3d = o3d.geometry.Image(rgb_mask)
 
 
43
  rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth(image_o3d, depth_o3d, convert_rgb_to_intensity=False)
44
  # Step 3: Create a PointCloud from the RGBD image
45
  pcd = o3d.geometry.PointCloud.create_from_rgbd_image(rgbd_image, o3d.camera.PinholeCameraIntrinsic(o3d.camera.PinholeCameraIntrinsicParameters.PrimeSenseDefault))
46
  # Step 4: Convert PointCloud data to a NumPy array
 
47
  points = np.asarray(pcd.points)
48
  colors = np.asarray(pcd.colors)
49
  print(np.unique(colors, axis=0))
@@ -163,7 +166,7 @@ class DepthPredictor:
163
  def generate_obj_masks2(self, image, masks, cube_size, n_samples, min_depth, max_depth):
164
  # Generate a point cloud
165
  depth = self.predict(image)
166
- depth = map_image_range(depth, min_depth, max_depth)
167
  image = np.array(image)
168
  mesh = o3d.geometry.TriangleMesh()
169
  # Create cubes and add them to the mesh
 
37
  assert type(depth) == np.ndarray
38
  rgb_mask = np.zeros((mask.shape[0], mask.shape[1], 3)).astype("uint8")
39
  rgb_mask[mask] = (255, 0, 0)
40
+ print(np.unique(rgb_mask))
41
  depth_o3d = o3d.geometry.Image(depth)
42
  image_o3d = o3d.geometry.Image(rgb_mask)
43
+ print(len(depth_o3d))
44
+ print(len(image_o3d))
45
  rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth(image_o3d, depth_o3d, convert_rgb_to_intensity=False)
46
  # Step 3: Create a PointCloud from the RGBD image
47
  pcd = o3d.geometry.PointCloud.create_from_rgbd_image(rgbd_image, o3d.camera.PinholeCameraIntrinsic(o3d.camera.PinholeCameraIntrinsicParameters.PrimeSenseDefault))
48
  # Step 4: Convert PointCloud data to a NumPy array
49
+ print(len(pcd))
50
  points = np.asarray(pcd.points)
51
  colors = np.asarray(pcd.colors)
52
  print(np.unique(colors, axis=0))
 
166
  def generate_obj_masks2(self, image, masks, cube_size, n_samples, min_depth, max_depth):
167
  # Generate a point cloud
168
  depth = self.predict(image)
169
+ #depth = map_image_range(depth, min_depth, max_depth)
170
  image = np.array(image)
171
  mesh = o3d.geometry.TriangleMesh()
172
  # Create cubes and add them to the mesh