# Task: Adapt Stereo Depth Estimator for Scanbot Vision **Priority:** HIGH **Source file:** `RockMapping/detection/stereo_depth.py` **Target file:** `Scanbot/src/vision/stereo_depth.py` **Dependencies:** numpy, opencv-python ## What to Do Copy `RockMapping/detection/stereo_depth.py` to `Scanbot/src/vision/stereo_depth.py` with these changes: 1. **Rename** `estimate_rock_size()` → `estimate_object_size()` (same logic, generic name) 2. **Remove** `classify_rock_size()` method entirely (zone classification is handled by pipeline.py) 3. **Keep everything else identical** — StereoSGBM parameters, calibration I/O, disparity-to-distance formula, bbox distance extraction ## The source file has these methods (keep all except classify_rock_size): - `__init__(self, config_path=None)` — StereoSGBM setup with tuned params - `load_calibration(self, config_path)` — Load JSON calibration - `save_calibration(self, config_path)` — Save JSON calibration - `split_stereo_frame(self, frame)` — Split 2560x720 side-by-side into left/right - `compute_disparity(self, left, right)` — StereoSGBM → disparity map - `disparity_to_distance(self, disparity)` — Formula: distance = (baseline * focal) / disparity - `get_distance_at_bbox(self, disparity, bbox)` — Median distance in bbox region - `estimate_rock_size()` → RENAME to `estimate_object_size()` - `classify_rock_size()` → REMOVE - `calibrate_from_point(self, disparity_value, actual_distance_m)` — Interactive calibration ## Camera specs (same hardware): - ELP-USB3DGS1200P01-V83 - 60mm baseline, 100° HFOV, global shutter - Side-by-side 2560x720 output ## Do NOT change: - StereoSGBM parameters (they're tuned for this camera) - Focal length calculation - Disparity-to-distance formula - Calibration JSON format