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()
相关推荐
IT_陈寒2 分钟前
SpringBoot自动配置把我坑惨了,原来它偷偷干了这么多事
前端·人工智能·后端
大模型实验室Lab4AI3 分钟前
KNOWLEDGE IS NOT STATIC: ORDER-AWARE HYPERGRAPH RAG FOR LANGUAGE MODELS(论文解读)
人工智能·语言模型·自然语言处理
JEECG低代码平台3 分钟前
2026年AI编码CLI工具终极对比:Claude Code、Cursor、Gemini CLI、Codex CLI、Copilot CLI
人工智能·copilot
多年小白7 分钟前
DeepSeek V4 全面换装华为昇腾 950PR
网络·人工智能·科技·深度学习·ai
算.子7 分钟前
【Spring AI 实战】六、RAG文档 ETL 实战:PDF/Word/Markdown 解析与文本分割
人工智能·spring·etl
道可云7 分钟前
AI正在改变一切!园区举办AI智能体主题沙龙
人工智能
lulu12165440788 分钟前
Claude Opus 4.7有哪些重大升级?软件工程和视觉能力全面解析
java·人工智能·python·软件工程·ai编程
笃℃9 分钟前
【多模态大语言模型】Qwen-VL 系列解读,持续更新中。。。
人工智能·语言模型·自然语言处理
ar012311 分钟前
AR航空装配:赋能航空航天制造的智能化转型
人工智能·ar
七夜zippoe12 分钟前
OpenClaw 定时任务与 Cron 调度:自动化运维的智能引擎
运维·人工智能·自动化·cron·openclaw