# Fiducial Marker Pose Calculator AI Agent Connect

> Fiducial Marker Pose Calculator MCP solves the Perspective-n-Point (PnP) problem by mapping 2D marker corner pixels to 3D camera-space poses. It uses your camera's intrinsics, distortion models, and physical marker dimensions to calculate exact position and orientation.

## Overview
- **Category:** geometry
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_KxrlbTdWmsvC4HEK3ikSIYu1l3jCD38GjTmT8hQg/ai-agent-connect
- **Tags:** pnp, fiducial-markers, camera-calibration, pose-estimation, computer-vision

## Description

You can use this MCP to bridge the gap between 2D image detections and 3D spatial awareness. If you have the pixel coordinates of a fiducial marker's corners, your AI client can now determine exactly where that marker sits in 3D space relative to the camera. It handles the heavy lifting of the PnP math by incorporating camera intrinsics and lens distortion models. This makes it a practical tool for robotics, augmented reality, or any computer vision task where you need to know an object's pose from a single viewpoint. Instead of writing custom geometry solvers, you hand the corner data to your agent and get back the rotation matrix and translation vector.

## Tools

### calculate_reprojection_error
Measures how well the calculated 3D pose aligns with the original 2D pixel locations.

### check_pose_ambiguity
Evaluates the stability of the calculated pose to see if the geometry is uncertain.

### estimate_marker_pose
Calculates the 3D position and orientation of a marker based on its 2D corner detections.

### validate_corner_sequence
Checks if the detected corner pixels follow a valid geometric sequence to prevent calculation errors.

## Prompt Examples

**Prompt:** 
```
Calculate the pose for a marker with corners at [{"x":10, "y":10}, {"x":50, "y":10}, {"x":50, "y":50}, {"x":10, "y":50}], side length 0.05m, intrinsics {"fx":500, "fy":500, "cx":320, "cy":240}, distortion {"k1":0, "k2":0, "k3":0, "p1":0, "p2":0}, corner order 'TL-TR-BR-BL', and method 'iterative'.
```

**Response:** 
```
The estimated transform has a rotation matrix of [[1,0,0],[0,1,0],[0,0,1]] and a translation vector of [0.5, 0, 1.2]. The reprojection error is 0.2 pixels.
```

**Prompt:** 
```
Check if these corners are in a valid sequence: [{"x":10, "y":10}, {"x":50, "y":50}, {"x":50, "y":10}, {"x":10, "y":50}] with order 'TL-TR-BR-BL'.
```

**Response:** 
```
The sequence is invalid: self-intersecting polygon.
```

**Prompt:** 
```
Is the pose stable for a marker at these coordinates with this transform?
```

**Response:** 
```
The ambiguity score is 0.15, indicating a highly stable pose.
```

## Capabilities

### 3D Pose Estimation
Your agent calculates the 3D position and orientation from 2D corner data.

### Geometric Validation
The MCP verifies that corner sequences are geometrically sound before processing.

### Accuracy Measurement
It quantifies how well the 3D pose matches the 2D pixel observations.

### Stability Analysis
The tool checks for pose ambiguity to ensure the result is reliable.

## Use Cases

### Robot Localization
A robot uses fiducial markers on the floor to determine its exact position in a room.

### Augmented Reality Anchoring
A mobile app uses marker corners to place a 3D object on a physical surface.

### Quality Control
A vision system checks the orientation of parts on a conveyor belt using markers.

### Camera Calibration Testing
Engineers use reprojection error tools to validate their camera intrinsic models.

## Benefits

- Solves the PnP problem without manual math implementation.
- Integrates camera distortion models directly into the pose calculation.
- Provides error metrics to verify the quality of the estimation.
- Detects invalid corner sequences to prevent bad data from breaking your logic.

## How It Works

Connect the MCP to your client and start sending coordinate data.

1. Connect your AI client to the Vinkius-hosted MCP.
2. Provide the 2D pixel coordinates of the marker corners.
3. Include camera intrinsics and marker physical dimensions.
4. The MCP calculates the 3D transform and returns the pose.

## Frequently Asked Questions

**What is the PnP problem?**
Perspective-n-Point is the process of estimating the pose of a calibrated camera given a set of $n$ 3D points and their corresponding 2D projections.

**Does this MCP handle lens distortion?**
Yes, it uses distortion models to account for lens imperfections during the pose estimation process.

**How do I know if my pose estimate is accurate?**
You can use the calculate_reprojection_error tool to see how well the 3D points align with your 2D pixels.

**Can I use this with Claude or Cursor?**
Yes, any MCP-compatible client like Claude, Cursor, or Windsurf can use this tool once connected via Vinkius.

**What happens if my corner detection is wrong?**
The validate_corner_sequence tool can check if your detected pixels form a valid geometric shape before you attempt to calculate a pose.

**What information is required to estimate a pose?**
To use `estimate_marker_pose`, you need the corner pixel coordinates, the physical side length of the marker, camera intrinsics (fx, fy, cx, cy), distortion coefficients, the expected corner order, and the PnP method.

**How can I verify if my corner detection is correct?**
You can use `validate_corner_sequence` to check if the detected pixels form a valid, non-self-intersecting quadrilateral following your specified convention.

**What does reprojection error represent?**
The reprojection error, calculated via `calculate_reprojection_error`, is the average distance in pixels between the original detected corners and the 3D points projected back onto the 2D image plane.
