No project description provided
Project description
📝 simple library to make life easy when deploying superpoint, superglue models
:gear: Installation
pip install superpoint_superglue_deployment
:tada: TODO
- interface to deploy superpoint, superglue
- testing on real data
:running: How to Run
Basic usage
import cv2
import numpy as np
from loguru import logger
from superpoint_superglue_deployment import Matcher
def main():
query_image = cv2.imread("./data/images/one_pillar_pagoda_1.jpg")
ref_image = cv2.imread("./data/images/one_pillar_pagoda_2.jpg")
query_gray = cv2.imread("./data/images/one_pillar_pagoda_1.jpg", 0)
ref_gray = cv2.imread("./data/images/one_pillar_pagoda_2.jpg", 0)
superglue_matcher = Matcher(
{
"superpoint": {
"input_shape": (-1, -1),
"keypoint_threshold": 0.003,
},
"superglue": {
"match_threshold": 0.5,
},
"use_gpu": True,
}
)
query_kpts, ref_kpts, _, _, matches = superglue_matcher.match(query_gray, ref_gray)
M, mask = cv2.findHomography(
np.float64([query_kpts[m.queryIdx].pt for m in matches]).reshape(-1, 1, 2),
np.float64([ref_kpts[m.trainIdx].pt for m in matches]).reshape(-1, 1, 2),
method=cv2.USAC_MAGSAC,
ransacReprojThreshold=5.0,
maxIters=10000,
confidence=0.95,
)
logger.info(f"number of inliers: {mask.sum()}")
matches = np.array(matches)[np.all(mask > 0, axis=1)]
matches = sorted(matches, key=lambda match: match.distance)
matched_image = cv2.drawMatches(
query_image,
query_kpts,
ref_image,
ref_kpts,
matches[:50],
None,
flags=2,
)
cv2.imwrite("matched_image.jpg", matched_image)
if __name__ == "__main__":
main()
🎛 Development environment
mamba env create --file environment.yml
mamba activate superpoint_superglue_deployment
:gem: References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for superpoint_superglue_deployment-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92acc331d3a04f746549cbcf647a1affac0615640d87565f62802cc2dd59ee05 |
|
MD5 | 06f712baf1245d7a4e18c6f7398bc91b |
|
BLAKE2b-256 | 627ec514d48fbf312e53b3ed4ed0a7466e8ddbcc14c7a3a551b52e86244e02e9 |
Close
Hashes for superpoint_superglue_deployment-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a34361015761dd3d89977e8f8cd53b10d41e49c689eb0a73da10c5cdc5880a8b |
|
MD5 | 99479bd8bd60b76dc3e854dc109a625e |
|
BLAKE2b-256 | 669efe428b58a48f5ee53b3b216f35f3acc17a0ef415d33429e402ebe226e573 |