# Planar Homography Transform Calculator AI Agent Connect

> Planar Homography Transform Calculator MCP handles the heavy math for projective geometry. It uses normalized Direct Linear Transformation and solid inlier selection to turn sets of matched image points into accurate 3x3 transformation matrices. You can check numerical stability, validate point sets, and measure reprojection errors directly through your AI client.

## Overview
- **Category:** mathematics
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_oRpeDKhMYPskZI2BoYGI8UyMFFCsO9On9aSES9G8/ai-agent-connect
- **Tags:** homography, dlt, image-processing, geometry, matrix-math

## Description

If you're working with computer vision or geometric transformations, you know how messy point correspondences can get. This MCP takes the manual math off your plate. It uses a normalized Direct Linear Transformation (DLT) approach to derive the 3x3 homography matrix you need to map one plane to another. 

Instead of manually solving systems of equations, you provide your matched points to your agent. It doesn't spit out a matrix; it evaluates how good that matrix actually is. It identifies inliers and calculates residuals so you know if your data is actually usable. You can also test the stability of your results to ensure your transformation won't fall apart due to numerical issues. It's a specialized math engine for anyone needing to handle planar projections without writing the underlying linear algebra from scratch.

## Tools

### get_reprojection_error
This tool measures the geometric distance between a target point and a transformed source point. It's how you verify how well your matrix actually maps points.

### analyze_conditioning
This tool provides a qualitative look at how numerically stable your transformation is. It helps you catch matrices that might be too sensitive to small changes in input.

### calculate_homography
This is the core tool that computes the 3x3 transformation matrix. It also returns the quality of the fit, including singular values, inliers, and residuals.

### validate_point_set
This tool checks if your set of points is geometrically capable of producing a homography. It catches issues like collinear points before you try to run a calculation.

## Prompt Examples

**Prompt:** 
```
Calculate the homography for these points: src=[{"x":0,"y":0},{"x":100,"y":0},{"x":100,"y":100},{"x":0,"y":100}] and dst=[{"x":10,"y":10},{"x":110,"y":10},{"x":110,"y":110},{"x":10,"y":110}] with a threshold of 1.0
```

**Response:** 
```
The transformation matrix is [[1, 0, 10], [0, 1, 10], [0, 0, 1]]. All 4 points are inliers.
```

**Prompt:** 
```
Are these points valid for a homography: [{"x":1,"y":1},{"x":2,"y":2},{"x":3,"y":3}]?
```

**Response:** 
```
No, the set is invalid because the points are collinear.
```

**Prompt:** 
```
Check the reprojection error for a point at {50, 50} using matrix [[1,0,0],[0,1,0],[0,0,1]] and a threshold of 0.5
```

**Response:** 
```
The distance is 0.0, which is within the threshold.
```

## Capabilities

### Matrix Computation
Your agent generates the full 3x3 projective transformation matrix from point pairs.

### Geometric Validation
The MCP checks if your input points are geometrically valid for a planar transform.

### Error Measurement
It calculates the distance between projected points and their targets to verify accuracy.

### Stability Analysis
The tool assesses the numerical conditioning of the resulting transformation.

### Inlier Detection
It identifies which points in your set fit the model and which are outliers.

## Use Cases

### Image Rectification
Transform a skewed perspective of a flat object back into a front-facing view.

### Image Stitching
Find the homography needed to align two overlapping images of a single plane.

### Augmented Reality
Calculate the projection required to overlay digital content onto a real-world surface.

### Document Scanning
Correct the perspective of a photo of a document to make it look flat.

## Benefits

- Replaces manual linear algebra implementations with a solid DLT approach.
- Reduces errors by validating point sets before attempting calculations.
- Provides immediate feedback on transformation quality through residuals and inliers.
- Automates the detection of numerical instability in projective matrices.

## How It Works

Connecting to this MCP gives your AI client direct access to specialized geometric math tools.

1. Connect your preferred client like Claude or Cursor to the Vinkius-hosted MCP.
2. Provide your source and destination point coordinates to your agent.
3. Your agent calls the calculation tools to solve the DLT problem.
4. The MCP returns the transformation matrix and quality metrics.
5. You use the resulting matrix for your specific geometric application.

## Frequently Asked Questions

**What math method does this MCP use?**
It uses normalized Direct Linear Transformation (DLT) with solid inlier selection to compute the homography.

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

**How do I know if my transformation is accurate?**
You can use the get_reprojection_error tool to measure the distance between points and the calculate_homography tool to check residuals.

**What happens if my points are collinear?**
The validate_point_set tool will identify that the set is geometrically invalid for homography computation.

**Does this MCP handle the hosting?**
Yes, Vinkius hosts the MCP and manages the execution, so you don't need to run any local math libraries.

**What is required to calculate a homography?**
You need at least four non-collinear point correspondences. You can use `validate_point_set` to check if your points are suitable before running the calculation.

**How do I know if my transformation is numerically stable?**
You can use the `analyze_conditioning` tool with the singular values returned by the calculation to get a stability rating.

**What does the reprojection error represent?**
It is the Euclidean distance between the actual target point and the point predicted by the calculated homography matrix.
