Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

1.0 KB
Raw Blame

XFeat.match_xfeat matches a batch of image pairs: image b of img1 with image b of img2. For a batch of more than one pair it now returns a list with one (N, 4) tensor of (x1, y1, x2, y2) matches per pair, as match_xfeat_star does, and an empty batch gives an empty list. Before, a batch was extracted whole, but only its first pair was matched, and the method returned the tuple (mkpts0, mkpts1) of that pair alone. Code that unpacked the result of a batched call must change: with two pairs, mkpts0, mkpts1 = model.match_xfeat(a, b) still unpacks, but now into the (N, 4) matches of pair 0 and of pair 1. A single pair still returns (mkpts0, mkpts1), and batches of different sizes raise. Each batch runs through detectAndCompute once: matching 2, 4 and 8 pairs of 640 x 480 images in one call instead of one call per pair is 1.6x, 2.7x and 3.8x faster on CUDA (RTX 4090). For two pairs it is 1.26x faster on MPS (Apple M1) and 1.1-1.2x on an x86 CPU, but 0.93x on an Apple M1 CPU, where one call per pair stays faster.