File size: 1,400 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---
title: "imcui.api.core"
description: "Core API module for image matching operations"
---

# imcui.api.core

Core API module for programmatic image matching operations.

## ImageMatchingAPI

Main API class for image matching operations.

### Import

```python
from imcui.api import ImageMatchingAPI
```

### Constructor

```python
ImageMatchingAPI(conf, device="cuda")
```

**Parameters:**

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `conf` | dict | Yes | - | Matcher configuration from get_matcher_zoo() |
| `device` | str | No | "cuda" | Device: "cuda", "cpu", "mps" |

### Usage

```python
from imcui.api import ImageMatchingAPI
from imcui.ui import get_matcher_zoo

# Get matcher configuration
matchers = get_matcher_zoo()

# Initialize API
api = ImageMatchingAPI(conf=matchers["superpoint-lightglue"], device="cuda")

# Match two images (RGB numpy arrays)
result = api(image0, image1)
```

### Return Value

Dictionary containing:

```python
{
    "keypoints0": np.ndarray,  # Shape: (N, 2)
    "keypoints1": np.ndarray,  # Shape: (M, 2)
    "matches": np.ndarray,     # Shape: (K, 2)
    "scores": np.ndarray,      # Shape: (K,)
    "H": np.ndarray            # Optional: Homography matrix (3x3)
}
```

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