jens commited on
Commit
6bea180
·
1 Parent(s): afd1abe
Files changed (1) hide show
  1. utils.py +4 -4
utils.py CHANGED
@@ -138,15 +138,15 @@ def array_PCL(rgb_image, depth_image):
138
  #cam_RGB = np.apply_along_axis(np.linalg.inv(R).dot, 1, pcd) - np.linalg.inv(R).dot(T)
139
  xx_rgb = ((rgb_image[:, 0] * FX_RGB) / rgb_image[:, 2] + CX_RGB + width / 2).astype(int).clip(0, width - 1)
140
  yy_rgb = ((rgb_image[:, 1] * FY_RGB) / rgb_image[:, 2] + CY_RGB).astype(int).clip(0, height - 1)
141
- colors = rgb_image[yy_rgb, xx_rgb]/255
142
- return pcd, colors
143
 
144
  def generate_PCL(image):
145
  depth_predictor = DepthPredictor()
146
  depth_result = depth_predictor.predict(image)
147
  image = np.array(image)
148
- pcd, colors = array_PCL(image, depth_result)
149
- fig = px.scatter_3d(x=pcd[:, 0], y=pcd[:, 1], z=pcd[:, 2], color=colors, size_max=0.1)
150
  return fig
151
 
152
 
 
138
  #cam_RGB = np.apply_along_axis(np.linalg.inv(R).dot, 1, pcd) - np.linalg.inv(R).dot(T)
139
  xx_rgb = ((rgb_image[:, 0] * FX_RGB) / rgb_image[:, 2] + CX_RGB + width / 2).astype(int).clip(0, width - 1)
140
  yy_rgb = ((rgb_image[:, 1] * FY_RGB) / rgb_image[:, 2] + CY_RGB).astype(int).clip(0, height - 1)
141
+ #colors = rgb_image[yy_rgb, xx_rgb]/255
142
+ return pcd#, colors
143
 
144
  def generate_PCL(image):
145
  depth_predictor = DepthPredictor()
146
  depth_result = depth_predictor.predict(image)
147
  image = np.array(image)
148
+ pcd = array_PCL(image, depth_result)
149
+ fig = px.scatter_3d(x=pcd[:, 0], y=pcd[:, 1], z=pcd[:, 2], size_max=0.1)
150
  return fig
151
 
152