yxma commited on
Commit
10fbe83
·
verified ·
1 Parent(s): 8420318

Toolbox: grayscale depth view (standard GelSight height-map convention) + regen demo

Browse files
figures/toolbox_demo.png CHANGED

Git LFS Details

  • SHA256: e29b488dcc5a0ce2caa1879a236ff7fda8344968b3ec68948face68ea7a07476
  • Pointer size: 131 Bytes
  • Size of remote file: 504 kB

Git LFS Details

  • SHA256: d422ede135073bfdab95fac39c52ed339f89978b346948864d238d63997a397b
  • Pointer size: 131 Bytes
  • Size of remote file: 494 kB
toolbox/quickstart.md CHANGED
@@ -58,7 +58,7 @@ python -m react_toolbox.demo --with_depth
58
  | `reference` | `get_reference`, `difference`, `l2_diff` | p01 / first / running-avg reference; Sparsh signed diff |
59
  | `contact` | `contact_mask`, `contact_metrics`, `contact_centroid` | diff→threshold→largest component; reproduces dataset scalars |
60
  | `depth` | `height_map`, `normals`, `poisson_integrate` | **approximate, uncalibrated** — pretrained markerless-Mini net (`nnmini.pt`, fetched on demand) + DCT Poisson |
61
- | `viz` | `diff_heatmap`, `contact_overlay`, `reference_compare`, `depth_view`, `height_to_pointcloud` | all return RGB uint8 |
62
  | `calibration` | `load_calibration`, `project_gel_to_pixel` | per-task extrinsics (motherboard=May-12, pushT=June-26) |
63
  | `actions` | `next_state_action`, `delta_pose_action`, `integrate_delta` | handheld pose → IL/world-model targets |
64
 
 
58
  | `reference` | `get_reference`, `difference`, `l2_diff` | p01 / first / running-avg reference; Sparsh signed diff |
59
  | `contact` | `contact_mask`, `contact_metrics`, `contact_centroid` | diff→threshold→largest component; reproduces dataset scalars |
60
  | `depth` | `height_map`, `normals`, `poisson_integrate` | **approximate, uncalibrated** — pretrained markerless-Mini net (`nnmini.pt`, fetched on demand) + DCT Poisson |
61
+ | `viz` | `diff_heatmap`, `contact_overlay`, `reference_compare`, `depth_view` (grayscale by default = standard GelSight height map; cmap= for colormap), `contact_overlay`, `reference_compare`, `height_to_pointcloud` all return RGB uint8 |
62
  | `calibration` | `load_calibration`, `project_gel_to_pixel` | per-task extrinsics (motherboard=May-12, pushT=June-26) |
63
  | `actions` | `next_state_action`, `delta_pose_action`, `integrate_delta` | handheld pose → IL/world-model targets |
64
 
toolbox/viz.py CHANGED
@@ -39,11 +39,20 @@ def reference_compare(frame, reference):
39
  return np.concatenate([reference, frame, sd], axis=1)
40
 
41
 
42
- def depth_view(height_map, cmap="viridis"):
43
- """Colormap a (H, W) height map to an RGB image."""
 
 
 
 
 
44
  h = height_map.astype(np.float32)
45
  rng = h.max() - h.min()
46
- return _colormap((h - h.min()) / (rng + 1e-6), cmap)
 
 
 
 
47
 
48
 
49
  def height_to_pointcloud(height_map, stride=4, z_scale=1.0):
 
39
  return np.concatenate([reference, frame, sd], axis=1)
40
 
41
 
42
+ def depth_view(height_map, cmap="gray"):
43
+ """Render a (H, W) height map as an RGB image.
44
+
45
+ Default is **grayscale** (brighter = higher), the standard GelSight
46
+ height-map convention (gsrobotics, GelSight Wedge, depth-recon papers).
47
+ Pass cmap="turbo"/"jet"/"viridis" for a colormapped view instead.
48
+ """
49
  h = height_map.astype(np.float32)
50
  rng = h.max() - h.min()
51
+ norm = (h - h.min()) / (rng + 1e-6)
52
+ if cmap in (None, "gray", "grey", "grayscale"):
53
+ g = (np.clip(norm, 0, 1) * 255).astype(np.uint8)
54
+ return np.repeat(g[..., None], 3, axis=2) # (H,W,3) gray RGB
55
+ return _colormap(norm, cmap)
56
 
57
 
58
  def height_to_pointcloud(height_map, stride=4, z_scale=1.0):