-
大小: 7.11MB文件类型: .zip金币: 2下载: 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+ selenium教程
- PycURL(Windows7/Win32)Python2.7安装包 P
- 英文原版-Scientific Computing with Python
- 7.图像风格迁移 基于深度学习 pyt
- 基于Python的学生管理系统
- A Byte of Python(简明Python教程)(第
- Python实例174946
- Python 人脸识别
- Python 人事管理系统
- 基于python-flask的个人博客系统
- 计算机视觉应用开发流程
- python 调用sftp断点续传文件
- python socket游戏
- 基于Python爬虫爬取天气预报信息
- python函数编程和讲解
- Python开发的个人博客
- 基于python的三层神经网络模型搭建
- python实现自动操作windows应用
- python人脸识别(opencv)
- python 绘图(方形、线条、圆形)
- python疫情卡UN管控
- python 连连看小游戏源码
- 基于PyQt5的视频播放器设计
- 一个简单的python爬虫
- csv文件行列转换python实现代码
- Python操作Mysql教程手册
- Python Machine Learning Case Studies
- python获取硬件信息
- 量化交易(附python常见函数的使用方
- python 名字用字排行
评论
共有 条评论