ICCV2025 特征点检测 图像匹配 RIPE

目测对刚性物体效果比较好

代码:https://github.com/fraunhoferhhi/RIPE

论文:https://arxiv.org/abs/2507.04839

python 复制代码
import cv2
import kornia.feature as KF
import kornia.geometry as KG
import matplotlib.pyplot as plt
import numpy as np
import torch
from torchvision.io import decode_image

from ripe import vgg_hyper
from ripe.utils.utils import cv2_matches_from_kornia, resize_image, to_cv_kpts

dev = torch.device("cuda" if torch.cuda.is_available() else "cpu")

model = vgg_hyper().to(dev)
model.eval()

image1 = resize_image(decode_image("assets/all_souls_000013.jpg").float().to(dev) / 255.0)
image2 = resize_image(decode_image("assets/all_souls_000055.jpg").float().to(dev) / 255.0)

kpts_1, desc_1, score_1 = model.detectAndCompute(image1, threshold=0.5, top_k=2048)
kpts_2, desc_2, score_2 = model.detectAndCompute(image2, threshold=0.5, top_k=2048)

matcher = KF.DescriptorMatcher("mnn")  # threshold is not used with mnn
match_dists, match_idxs = matcher(desc_1, desc_2)

matched_pts_1 = kpts_1[match_idxs[:, 0]]
matched_pts_2 = kpts_2[match_idxs[:, 1]]

H, mask = KG.ransac.RANSAC(model_type="fundamental", inl_th=1.0)(matched_pts_1, matched_pts_2)
matchesMask = mask.int().ravel().tolist()

result_ransac = cv2.drawMatches(
    (image1.cpu().permute(1, 2, 0).numpy() * 255.0).astype(np.uint8),
    to_cv_kpts(kpts_1, score_1),
    (image2.cpu().permute(1, 2, 0).numpy() * 255.0).astype(np.uint8),
    to_cv_kpts(kpts_2, score_2),
    cv2_matches_from_kornia(match_dists, match_idxs),
    None,
    matchColor=(0, 255, 0),
    matchesMask=matchesMask,
    # matchesMask=None, # without RANSAC filtering
    singlePointColor=(0, 0, 255),
    flags=cv2.DrawMatchesFlags_DEFAULT,
)

plt.imshow(result_ransac)
plt.axis("off")
plt.tight_layout()

plt.show()
相关推荐
吴佳浩4 分钟前
单卡5090跑125B 大模型:从安装、验证到基准测试的完整操作教程
人工智能
数智工坊8 分钟前
视觉SLAM第13讲|工程落地:双目视觉里程计系统架构设计与性能优化
人工智能·深度学习·线性代数·性能优化·矩阵·系统架构·机器人
newsxun9 分钟前
校园餐全链条管理有了“实操手册” ——《学校食品安全与营养健康管理操作指南》在成都发布
大数据·人工智能
空堂与归10 分钟前
GPT-6 智能界面上线,对话式 Agent 真没戏了?
人工智能·gpt·ai
码流子11 分钟前
05-AI数字人
人工智能
moonsims15 分钟前
AiBrainBox “高校算法创新”与“真实无人系统”的国产化智能端侧科研平台-高校 × 企业:构建面向低空与具身智能的产学研协同创新平台
人工智能
深蓝AI22 分钟前
Redis 文档 MCP 揭示 Agent 检索真相:3 个工具、双读路径,引用为什么不能交给模型编
人工智能·redis
FPGA信号处理2 小时前
【模式识别】第三节课:分类误差的来源与线性分类器
人工智能·分类·数据挖掘
hrrrrxeeeee2 小时前
电商从业者AI技能提升:证书选择与商品、客服、运营场景落地
人工智能
小和尚同志7 小时前
1.8k star 的开源 token 使用量监控神器— TokenTracker
人工智能·ai编程