File size: 1,157 Bytes
173dcbd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
---
title: "imcui.ui.geometry"
description: "Geometry estimation functions"
---

# imcui.ui.geometry

Geometry estimation functions for computing transformation matrices between matched points.

## Functions

### compute_geometry

Compute geometric transformation between matched keypoints.

```python
from imcui.ui import compute_geometry

H, mask = compute_geometry(
    kp0, kp1, matches,
    geometry_type="homography",
    ransac_method="CV2_USAC_MAGSAC"
)
```

**Parameters:**

| Parameter | Type | Description |
|-----------|------|-------------|
| `kp0` | np.ndarray | Keypoints from first image, shape (N, 2) |
| `kp1` | np.ndarray | Keypoints from second image, shape (M, 2) |
| `matches` | np.ndarray | Matched point pairs, shape (K, 2) |
| `geometry_type` | str | Geometry type: "homography", "fundamental", "essential" |
| `ransac_method` | str | RANSAC method: "RANSAC", "CV2_USAC_MAGSAC", "LMEDS" |

**Returns:**

- `H`: Transformation matrix (3x3 for homography/fundamental)
- `mask`: Boolean mask indicating inliers

**Source Code**: [imcui/ui/geometry.py](https://github.com/Vincentqyw/image-matching-webui/blob/main/imcui/ui/geometry.py)