-
大小: 7.11MB文件类型: .zip金币: 1下载: 0 次发布日期: 2023-09-23
- 语言: Python
- 标签: superpoint 图像拼接 python deeplearning
资源简介
博客连接https://blog.csdn.net/qq_33591712/article/details/84947829#comments
用superpoint方法代替surf提取图像特征,进行Python版本的图像拼接。
代码片段和文件信息
import cv2
import numpy as np
from sp_extractor import SuperPointFrontend
class matchers:
def __init__(self):
self.surf = cv2.xfeatures2d.SURF_create()
self.detector = SuperPointFrontend(weights_path=“superpoint_v1.pth“
nms_dist=4
conf_thresh=0.015
nn_thresh=0.7
cuda=True)
FLANN_INDEX_KDTREE = 0
index_params = dict(algorithm=0 trees=5)
search_params = dict(checks=50)
self.flann = cv2.FlannbasedMatcher(index_params search_params)
def match(self i1 i2 direction=None):
imageSet1 = self.getSURFFeatures(i1)
imageSet2 = self.getSURFFeatures(i2)
print “Direction : “ direction
matches = self.flann.knnMatch(
np.asarray(imageSet2[‘des‘]np.float32)
np.asarray(imageSet1[‘des‘]np.float32)
k=2
)
good = []
for i (m n) in enumerate(matches):
if m.distance < 0.7*n.distance:
good.append((m.trainIdx m.queryIdx))
if len(good) > 4:
pointsCurrent = imageSet2[‘kp‘]
pointsPrevious = imageSet1[‘kp‘]
matchedPointsCurrent = np.float32(
[pointsCurrent[i] for (__ i) in good]
)
matchedPointsPrev = np.float32(
[pointsPrevious[i] for (i __) in good]
)
H s = cv2.findHomography(matchedPointsCurrent matchedPointsPrev cv2.RANSAC 4)
return H
return None
def getSURFFeatures(self im):
gray = cv2.cvtColor(im cv2.COLOR_BGR2GRAY)
pts desc heatmap = self.detector.run(gray)
#kp des = self.surf.detectAndCompute(gray None)
pts=np.delete(pts2axis=0)
desc=np.delete(desc2axis=0)
pts=np.transpose(pts)
desc=np.transpose(desc)
pts=pts.tolist()
desc=desc.tolist()
return {‘kp‘:pts ‘des‘:desc}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-11-11 19:38 Python-Multiple-Image-Stitching\
目录 0 2019-01-06 21:34 Python-Multiple-Image-Stitching\.git\
文件 23 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\HEAD
目录 0 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\branches\
文件 290 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\config
文件 73 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\desc
目录 0 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\hooks\
文件 478 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\hooks\applypatch-msg.sample
文件 896 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\hooks\commit-msg.sample
文件 189 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\hooks\post-update.sample
文件 424 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\hooks\pre-applypatch.sample
文件 1642 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\hooks\pre-commit.sample
文件 1348 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\hooks\pre-push.sample
文件 4898 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\hooks\pre-reba
文件 1239 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\hooks\prepare-commit-msg.sample
文件 3610 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\hooks\update.sample
文件 2248 2018-11-13 21:33 Python-Multiple-Image-Stitching\.git\index
目录 0 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\info\
文件 240 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\info\exclude
目录 0 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\logs\
文件 219 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\logs\HEAD
目录 0 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\logs\refs\
目录 0 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\logs\refs\heads\
文件 219 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\logs\refs\heads\master
目录 0 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\logs\refs\remotes\
目录 0 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\logs\refs\remotes\origin\
文件 219 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\logs\refs\remotes\origin\HEAD
目录 0 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\ob
目录 0 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\ob
文件 116 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\ob
目录 0 2018-11-11 19:22 Python-Multiple-Image-Stitching\.git\ob
............此处省略198个文件信息
相关资源
- 结巴分词、词性标注以及停用词过滤
- Python数据分析-pandas玩转Excel - 资料.
- python反编译工具Easy Python Decompiler
- Python性能分析与优化.pdf
- Python小说器
- numpy-1.13.1-cp27-none-win32.whl
- 机器学习对应的相关python代码SVM、C
- 中文文本聚类
- python 后台管理系统
- 声纹识别资料
- Introduction to time series.pdf + Deep Time Se
- OpenCV-Python中文教程
- 《廖雪峰Python2.7教程》高清完整PDF版
- Python标准库查询手册最新Python 3.3
- The Quick Python Book 3rd Edition.pdf
- Python学习思维导图
- OpenCV Python中文教程
- python for eclipse
- numpy-1.16.4.zip
- Python程序设计第3版- John M. Zelle 课件资
- Web Scraping with Python_Collecting Data from
- python TensorFlow 官方文档中文版
- Python3.6 中文文档.pdf
- 树莓派Python编程指南34705
- python项目源码
- Packt-Web.Scraping.with.Python.Richard Lawson
- Python编程实战:运用设计模式、并发
- 深入理解Python中文版.pdf
- QT5 Python GUI Programming Cookbook (2018)
- Hands-On Unsupervised Learning Using Python ep
评论
共有 条评论