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()
相关推荐
珊珊而川33 分钟前
Reflexion对ReAct的改进
人工智能
量化交易曾小健(金融号)35 分钟前
GPT-5 Instant能修补模型情商漏洞了
人工智能
听到微笑43 分钟前
LLM 只会生成文本?用 ReAct 模式手搓一个简易 Claude Code Agent
人工智能·langchain·llm
沐雪架构师1 小时前
让 Agent 说“机器能懂的话”——LlamaIndex 构建 Agent 的结构化输出策略
人工智能
Elastic 中国社区官方博客1 小时前
在 Elasticsearch 中改进 Agentic AI 工具的实验
大数据·数据库·人工智能·elasticsearch·搜索引擎·ai·全文检索
AI数据皮皮侠1 小时前
中国地级市旅游人数、收入数据(2000-2023年)
大数据·人工智能·python·深度学习·机器学习·旅游
mooooon L1 小时前
DAY 43 复习日-2025.10.7
人工智能·pytorch·python·深度学习·神经网络
zzywxc7872 小时前
AI 在金融、医疗、教育、制造业等领域都有广泛且深入的应用,以下是这些领域的一些落地案例
人工智能·金融·自动化·prompt·ai编程·xcode
你的大佬9992 小时前
阿里云百炼ai模型
人工智能·阿里云·云计算
koo3642 小时前
李宏毅机器学习笔记16
人工智能·笔记·机器学习