Robust Dense Feature Matching
Low maintenance activity. Last release 13 months ago. Weaker on commit activity and recent releases.
pip install romatch
RoMa 🏛️:
Robust Dense Feature Matching
⭐CVPR 2024⭐
Johan Edstedt · Qiyu Sun · Georg Bökman · Mårten Wadenbäck · Michael Felsberg
RoMa is the robust dense feature matcher capable of estimating pixel-dense warps and reliable certainties for almost any image pair.
Setup/Install
In your python environment (tested on Linux python 3.12), run:
uv pip install -e .
or
uv sync
You can also install romatch directly as a package from PyPI by
uv pip install romatch
or
uv add romatch
Fused local correlation kernel
Include the --extra fused-local-corr flag as:
uv sync --extra fused-local-corr
or
uv pip install romatch[fused-local-corr]
or
uv add romatch[fused-local-corr]
Demo / How to Use
We provide two demos in the demos folder. Here's the gist of it:
from romatch import roma_outdoor
roma_model = roma_outdoor(device=device)
# Match
warp, certainty = roma_model.match(imA_path, imB_path, device=device)
# Sample matches for estimation
matches, certainty = roma_model.sample(warp, certainty)
# Convert to pixel coordinates (RoMa produces matches in [-1,1]x[-1,1])
kptsA, kptsB = roma_model.to_pixel_coordinates(matches, H_A, W_A, H_B, W_B)
# Find a fundamental matrix (or anything else of interest)
F, mask = cv2.findFundamentalMat(
kptsA.cpu().numpy(), kptsB.cpu().numpy(), ransacReprojThreshold=0.2, method=cv2.USAC_MAGSAC, confidence=0.999999, maxIters=10000
)