colmap / test.py
vslamlab's picture
Upload folder using huggingface_hub
e8ace62 verified
raw
history blame contribute delete
751 Bytes
import torch
from feature_matcher_utilities import extract_keypoints, feature_matching
from lightglue import LightGlue
path_0 = "/media/alejandro/E45B-3EBD/FOR ALEX/8312297.jpg"
path_1 = "/media/alejandro/E45B-3EBD/FOR ALEX/8315088.jpg"
feats_dict0, h0, w0 = extract_keypoints(path_0, features="superpoint", rotations=[0])
feats_dict1, h1, w1 = extract_keypoints(path_1, features="superpoint", rotations=[1])
device = 'cuda' if torch.cuda.is_available() else 'cpu'
matcher = LightGlue(features='superpoint', depth_confidence=-1, width_confidence=-1, flash=True).eval().to(device)
matches_tensor = feature_matching(feats_dict0, feats_dict1, matcher=matcher, features="superpoint", matcher_type="lightglue")
print(len(matches_tensor))