# L3 Metric Refinement Component ## Detailed Description **L3 Metric Refinement** provides the "Pinpoint" accuracy. It takes a pair of images: the current UAV frame and a candidate Satellite Tile (provided by L2 or determined by the State Estimator's prediction). It uses **LiteSAM** to find dense correspondences between the aerial and satellite views. It computes a Homography and solves for the absolute world coordinate of the UAV center, achieving pixel-level accuracy. ## API Methods ### `refine_pose` - **Input:** `uav_frame: FrameObject`, `satellite_tile: SatelliteTile`, `prior_yaw: float` (optional) - **Output:** `L3Result` - **Description:** 1. Preprocesses images for LiteSAM. 2. Infers dense matches. 3. Filters outliers (RANSAC). 4. Computes Homography $H$. 5. Decomposes $H$ into rotation and translation (using camera intrinsics and tile GSD). 6. Returns `{ abs_lat: float, abs_lon: float, yaw: float, confidence: float, match_inliers: int }`. - **Test Cases:** - Perfect match pair -> Accurate Lat/Lon. - Mismatched pair (wrong tile) -> Low inlier count, Low confidence. ## Integration Tests - **Accuracy Verification:** Use a ground-truth pair (UAV image + known correct Satellite tile). Verify calculated Lat/Lon error is < 20 meters. ## Non-functional Tests - **Robustness:** Test with satellite images from different seasons (if available) or synthetically altered (color shift) to verify LiteSAM's semantic robustness.