|
39 | 39 |
|
40 | 40 | W, H = 20, 16 |
41 | 41 | FX = FY = 200.0 |
42 | | -CX, CY = 9.5, 7.5 # exact centre of 20 × 16 |
| 42 | +CX, CY = 9.5, 7.5 # exact centre of 20 × 16 |
43 | 43 |
|
44 | 44 | _STEREO_CFG = StereoDepthAdvancedConfig( |
45 | 45 | focal_length=FX, |
46 | 46 | cx=CX, |
47 | 47 | cy=CY, |
48 | | - baseline=100.0, # 100 mm |
| 48 | + baseline=100.0, # 100 mm |
49 | 49 | doffs=0.0, |
50 | 50 | z_far=1000.0, |
51 | | - conf_threshold=0.0, # accept all pixels |
| 51 | + conf_threshold=0.0, # accept all pixels |
52 | 52 | occ_threshold=0.0, |
53 | 53 | ) |
54 | 54 |
|
@@ -95,9 +95,7 @@ def _run_depth(depth: np.ndarray, cfg: DepthEstimationAdvanceConfig = _DEPTH_CFG |
95 | 95 | """Run DepthEstimation with a mocked depth array and return the result.""" |
96 | 96 | h, w = depth.shape |
97 | 97 | img = _image_bytes(w, h) |
98 | | - with patch.object( |
99 | | - DepthEstimationHandler, "_run_depth_anything_checkpoint", return_value=depth |
100 | | - ): |
| 98 | + with patch.object(DepthEstimationHandler, "_run_depth_anything_checkpoint", return_value=depth): |
101 | 99 | return DepthEstimation().run( |
102 | 100 | DepthEstimationCommand( |
103 | 101 | image_input=img, |
@@ -302,8 +300,8 @@ class TestDepthOrdering: |
302 | 300 | """Closer objects (larger disparity) must appear at smaller Z.""" |
303 | 301 |
|
304 | 302 | def test_stereo_larger_disparity_means_smaller_z(self): |
305 | | - disp_near = np.full((H, W), 50.0, dtype=np.float32) # closer |
306 | | - disp_far = np.full((H, W), 10.0, dtype=np.float32) # further |
| 303 | + disp_near = np.full((H, W), 50.0, dtype=np.float32) # closer |
| 304 | + disp_far = np.full((H, W), 10.0, dtype=np.float32) # further |
307 | 305 | pts_near = np.asarray(_run_stereo(disp_near).point_cloud.points) |
308 | 306 | pts_far = np.asarray(_run_stereo(disp_far).point_cloud.points) |
309 | 307 | assert pts_near[:, 2].mean() < pts_far[:, 2].mean(), ( |
|
0 commit comments