Spaces:
Configuration error
Configuration error
Update README.md
Browse files
README.md
CHANGED
|
@@ -88,12 +88,8 @@ Faces and license plates have been anonymized. To request removal of specific im
|
|
| 88 |
|
| 89 |
# Full Data Format Reference
|
| 90 |
|
| 91 |
-
|
| 92 |
|
| 93 |
-
**Minimal dependencies** (no SDK needed):
|
| 94 |
-
```
|
| 95 |
-
numpy, opencv-python, laspy==2.6.1, lazrs==0.8.0, scipy
|
| 96 |
-
```
|
| 97 |
|
| 98 |
---
|
| 99 |
|
|
@@ -164,7 +160,6 @@ World frame (inertial, right-handed, Z-up)
|
|
| 164 |
|
| 165 |
**All poses** in the dataset are 7-element vectors: `[x, y, z, qw, qx, qy, qz]` — translation in meters, unit quaternion **scalar-first**.
|
| 166 |
|
| 167 |
-
> **scipy note:** `scipy.spatial.transform.Rotation.from_quat()` expects scalar-**last** `[qx, qy, qz, qw]`. Swap accordingly.
|
| 168 |
|
| 169 |
**Transform chain** to go from camera frame to world frame:
|
| 170 |
|
|
@@ -238,7 +233,7 @@ img/cam_0/cam_0_<ts>.jpg — right camera
|
|
| 238 |
img/cam_1/cam_1_<ts>.jpg — left camera
|
| 239 |
```
|
| 240 |
|
| 241 |
-
- Filename pattern: `cam_\d+_(\d+)\.(jpg
|
| 242 |
- Images are **distorted**; undistort using `camera_infos[cam]["dist_coeffs"]` and the intrinsics
|
| 243 |
|
| 244 |
**Stereo rectification** requires computing the relative transform between `cam_1` (left) and `cam_0` (right) from `sensor_to_trajectory_poses`, then calling `cv2.stereoRectify`. The baseline is `np.linalg.norm(t_right_from_left)`.
|
|
@@ -304,13 +299,40 @@ agg_depth/cam_1/cam_1_<ts>.npz — depth for the cam_1 image at timestamp <ts>
|
|
| 304 |
**To get a depth map:** project `pts_cam` into the image using the camera intrinsics:
|
| 305 |
|
| 306 |
```python
|
| 307 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 308 |
pts = data["pts_cam"] # (N, 3) in cam_1's frame
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 314 |
```
|
| 315 |
|
| 316 |
**To transform to world coordinates:** chain `T_cam_to_rig` (from `sensor_to_trajectory_poses`) and `T_rig_to_world` (from interpolated trajectory at `ts + timestamp_offset`).
|
|
|
|
| 88 |
|
| 89 |
# Full Data Format Reference
|
| 90 |
|
| 91 |
+
This section describes the full data format in detail.
|
| 92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
---
|
| 95 |
|
|
|
|
| 160 |
|
| 161 |
**All poses** in the dataset are 7-element vectors: `[x, y, z, qw, qx, qy, qz]` — translation in meters, unit quaternion **scalar-first**.
|
| 162 |
|
|
|
|
| 163 |
|
| 164 |
**Transform chain** to go from camera frame to world frame:
|
| 165 |
|
|
|
|
| 233 |
img/cam_1/cam_1_<ts>.jpg — left camera
|
| 234 |
```
|
| 235 |
|
| 236 |
+
- Filename pattern: `cam_\d+_(\d+)\.(jpg)` — group 1 is timestamp in µs
|
| 237 |
- Images are **distorted**; undistort using `camera_infos[cam]["dist_coeffs"]` and the intrinsics
|
| 238 |
|
| 239 |
**Stereo rectification** requires computing the relative transform between `cam_1` (left) and `cam_0` (right) from `sensor_to_trajectory_poses`, then calling `cv2.stereoRectify`. The baseline is `np.linalg.norm(t_right_from_left)`.
|
|
|
|
| 299 |
**To get a depth map:** project `pts_cam` into the image using the camera intrinsics:
|
| 300 |
|
| 301 |
```python
|
| 302 |
+
import cv2, numpy as np, json
|
| 303 |
+
|
| 304 |
+
# Load calibration
|
| 305 |
+
with open("<sequence>/export/output.laz.trajectory.json") as f:
|
| 306 |
+
traj = json.load(f)
|
| 307 |
+
cam = traj["camera_infos"]["cam_1"]
|
| 308 |
+
fx, fy, cx, cy = cam["fx"], cam["fy"], cam["cx"], cam["cy"]
|
| 309 |
+
H, W = cam["image_height"], cam["image_width"]
|
| 310 |
+
|
| 311 |
+
# Load depth + image
|
| 312 |
+
data = np.load("<sequence>/agg_depth/cam_1/cam_1_<ts>.npz")
|
| 313 |
pts = data["pts_cam"] # (N, 3) in cam_1's frame
|
| 314 |
+
img = cv2.imread("<sequence>/img/cam_1/cam_1_<ts>.jpg")
|
| 315 |
+
|
| 316 |
+
# Project to pixel coordinates
|
| 317 |
+
z = pts[:, 2] # always > 0
|
| 318 |
+
u = (fx * pts[:, 0] / z + cx).astype(int)
|
| 319 |
+
v = (fy * pts[:, 1] / z + cy).astype(int)
|
| 320 |
+
|
| 321 |
+
# Keep only points inside image bounds
|
| 322 |
+
valid = (u >= 0) & (u < W) & (v >= 0) & (v < H)
|
| 323 |
+
u, v, z = u[valid], v[valid], z[valid]
|
| 324 |
+
|
| 325 |
+
# Build depth map (paint far-to-near so closer points overwrite)
|
| 326 |
+
depth_map = np.zeros((H, W), dtype=np.float32)
|
| 327 |
+
order = np.argsort(-z) # far first
|
| 328 |
+
depth_map[v[order], u[order]] = z[order]
|
| 329 |
+
|
| 330 |
+
# Overlay on image (color by depth)
|
| 331 |
+
z_norm = np.clip(z / z.max(), 0, 1)
|
| 332 |
+
colors = cv2.applyColorMap((z_norm * 255).astype(np.uint8), cv2.COLORMAP_TURBO)
|
| 333 |
+
for i in range(len(u)):
|
| 334 |
+
cv2.circle(img, (u[i], v[i]), 1, colors[i].tolist()[0], -1)
|
| 335 |
+
cv2.imwrite("depth_overlay.jpg", img)
|
| 336 |
```
|
| 337 |
|
| 338 |
**To transform to world coordinates:** chain `T_cam_to_rig` (from `sensor_to_trajectory_poses`) and `T_rig_to_world` (from interpolated trajectory at `ts + timestamp_offset`).
|