Spaces:
Sleeping
Sleeping
DariusGiannoli commited on
Commit Β·
c6ebd63
1
Parent(s): f36ea70
Home: add Epipolar Geometry tab to depth section
Browse files
app.py
CHANGED
|
@@ -191,7 +191,7 @@ in the benchmark at 256D.
|
|
| 191 |
# -------------------------------------------------------------------
|
| 192 |
st.header("π Stereo Depth Estimation")
|
| 193 |
|
| 194 |
-
tab_sgbm, tab_dav2 = st.tabs(["StereoSGBM (Classical)", "Depth Anything V2 (NN)"])
|
| 195 |
|
| 196 |
with tab_sgbm:
|
| 197 |
st.markdown("### π StereoSGBM β Semi-Global Block Matching")
|
|
@@ -252,6 +252,51 @@ The Stereo Stage shows both side-by-side with MAE, RMSE,
|
|
| 252 |
and Bad-2.0 pixel error against the Middlebury ground truth.
|
| 253 |
""")
|
| 254 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 255 |
st.divider()
|
| 256 |
st.caption("Select a pipeline from the **sidebar** to begin.")
|
| 257 |
|
|
|
|
| 191 |
# -------------------------------------------------------------------
|
| 192 |
st.header("π Stereo Depth Estimation")
|
| 193 |
|
| 194 |
+
tab_sgbm, tab_dav2, tab_epi = st.tabs(["StereoSGBM (Classical)", "Depth Anything V2 (NN)", "Epipolar Geometry (Sparse)"])
|
| 195 |
|
| 196 |
with tab_sgbm:
|
| 197 |
st.markdown("### π StereoSGBM β Semi-Global Block Matching")
|
|
|
|
| 252 |
and Bad-2.0 pixel error against the Middlebury ground truth.
|
| 253 |
""")
|
| 254 |
|
| 255 |
+
with tab_epi:
|
| 256 |
+
st.markdown("### π Epipolar Geometry β Sparse Stereo Matching")
|
| 257 |
+
col_e1, col_e2 = st.columns(2)
|
| 258 |
+
with col_e1:
|
| 259 |
+
st.markdown("""
|
| 260 |
+
**What it is:** The classical, principled way to find correspondences between a stereo pair.
|
| 261 |
+
|
| 262 |
+
Unlike StereoSGBM β which searches every pixel on the same row β the epipolar
|
| 263 |
+
approach works **point by point** on detected objects:
|
| 264 |
+
|
| 265 |
+
1. **Detect key-points** (ORB) inside the bounding box in the **left** image.
|
| 266 |
+
2. **Compute the fundamental matrix F** from the camera calibration:
|
| 267 |
+
""")
|
| 268 |
+
st.latex(r"F = K_R^{-T} \; [t]_\times \; K_L^{-1}")
|
| 269 |
+
st.markdown("""
|
| 270 |
+
3. **Project each key-point** through F β this produces an **epipolar line** in the right image.
|
| 271 |
+
4. **Template-match** a patch around the key-point *along* that line (NCC).
|
| 272 |
+
5. The x-offset between the two matches gives the **disparity** $d = x_L - x_R$.
|
| 273 |
+
6. Recover metric depth:
|
| 274 |
+
""")
|
| 275 |
+
st.latex(r"Z = \frac{f \times B}{d + d_{\text{offs}}}")
|
| 276 |
+
with col_e2:
|
| 277 |
+
st.markdown("""
|
| 278 |
+
**Why epipolar?**
|
| 279 |
+
|
| 280 |
+
For a rectified stereo pair the epipolar lines are horizontal, so the search
|
| 281 |
+
collapses to 1D β but you only pay the cost for key-points you actually care about,
|
| 282 |
+
not the whole image.
|
| 283 |
+
|
| 284 |
+
| | StereoSGBM | Epipolar (sparse) |
|
| 285 |
+
|---|---|---|
|
| 286 |
+
| **Scope** | All pixels | Key-points inside detections |
|
| 287 |
+
| **Search space** | Full row | Along epipolar line (1D) |
|
| 288 |
+
| **F matrix used** | β Implicit | β
Explicit |
|
| 289 |
+
| **Output** | Dense depth map | Depth per key-point |
|
| 290 |
+
| **Best for** | Full-scene depth | Object-level depth queries |
|
| 291 |
+
|
| 292 |
+
**In this app (Step 6 β Stereo Geometry tab):**
|
| 293 |
+
- ORB key-points are extracted from each detection bounding-box.
|
| 294 |
+
- F is built from the `cam0` / `cam1` matrices in the Middlebury `calib.txt`.
|
| 295 |
+
- For rectified Middlebury pairs the epipolar lines are verified horizontal
|
| 296 |
+
(row 0 of F β 0).
|
| 297 |
+
- Results are shown alongside the dense SGBM depth in a comparison table.
|
| 298 |
+
""")
|
| 299 |
+
|
| 300 |
st.divider()
|
| 301 |
st.caption("Select a pipeline from the **sidebar** to begin.")
|
| 302 |
|