fix(work_plane): project fit inliers from CV-frame pts_cv (not raw pc)

NuwaClient.pointcloud_roi's docstring claims OpenCV frame, but in
practice the raw payload arrives in Nuwa native frame (Z<0 forward).
nuwa_to_cv_frame is what actually flips it. Using `pts_cv` (post-flip
+ post-outlier-mask) makes the projection drop none of the inliers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Adriano Dal PastroandClaude Opus 4.7 committed 2026-05-13 11:13:20 +02:00
1 parent ae510e4387
commit 4a83305b5e
1 file changed
+5 -4
+5 -4
View File
@@ -115,8 +115,10 @@ def fit(req: FitReq) -> dict[str, Any]:
# Project the inliers used for the fit back to RGB pixels so the GUI can
# overlay them on the live image (verify visually which depth pixels were
# actually fed to fit_plane_svd). pc is in OpenCV camera frame already
# (per pointcloud_roi docstring); use Nuwa's RGB intrinsics.
# actually fed to fit_plane_svd). NOTE: pointcloud_roi's docstring claims
# CV frame, but in practice the raw `pc` arrives in Nuwa native frame
# (Z<0 forward). After nuwa_to_cv_frame + outlier mask, `pts_cv` is the
# canonical CV-frame inlier set, so use it.
fit_points_px: list[list[int]] = []
try:
intr_full = nuwa.intrinsics()
@@ -127,9 +129,8 @@ def fit(req: FitReq) -> dict[str, Any]:
H = int(rgb_intr.get("height", 480))
rgb_intr = {**rgb_intr, "width": W, "height": H}
K = K_from_intrinsics(rgb_intr)
inliers_cv = pc[inlier_mask, :3] # original CV-frame coords
with sw.step("project_inliers"):
fit_points_px = project_camera_to_pixels(inliers_cv, K, (W, H)).tolist()
fit_points_px = project_camera_to_pixels(pts_cv, K, (W, H)).tolist()
except Exception as e:
log.warning("could not project fit inliers to RGB pixels: %s", e)