diff --git a/src/presa_mano/api/work_plane_routes.py b/src/presa_mano/api/work_plane_routes.py index edd0b1b..011cb59 100644 --- a/src/presa_mano/api/work_plane_routes.py +++ b/src/presa_mano/api/work_plane_routes.py @@ -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)