Toolbox: grayscale depth view (standard GelSight height-map convention) + regen demo
Browse files- figures/toolbox_demo.png +2 -2
- toolbox/quickstart.md +1 -1
- toolbox/viz.py +12 -3
figures/toolbox_demo.png
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
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`
|
| 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="
|
| 43 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
h = height_map.astype(np.float32)
|
| 45 |
rng = h.max() - h.min()
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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):
|