资源简介
Python3实现的多图拼接,需要OpenCV,亲测可用,有代码有图,在cmd上跑

代码片段和文件信息
import cv2
import numpy as np
class matchers:
def __init__(self):
self.surf = cv2.xfeatures2d.SURF_create()
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(
imageSet2[‘des‘]
imageSet1[‘des‘]
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].pt for (__ i) in good]
)
matchedPointsPrev = np.float32(
[pointsPrevious[i].pt 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)
kp des = self.surf.detectAndCompute(gray None)
return {‘kp‘:kp ‘des‘:des}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\
目录 0 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\code\
文件 1194 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\code\matchers.py
文件 4147 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\code\pano.py
目录 0 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\code\txtlists\
文件 84 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\code\txtlists\files1.txt
文件 47 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\code\txtlists\files2.txt
文件 99 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\code\txtlists\files2.txt~
文件 59 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\code\txtlists\files3.txt
目录 0 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\images\
文件 47382 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\images\1.jpg
文件 78825 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\images\1Hill.JPG
文件 44167 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\images\2.jpg
文件 79971 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\images\2Hill.JPG
文件 40361 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\images\3.jpg
文件 79327 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\images\3Hill.JPG
文件 34014 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\images\S1.jpg
文件 38259 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\images\S2.jpg
文件 44614 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\images\S3.jpg
文件 41734 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\images\S5.jpg
文件 38498 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\images\S6.jpg
文件 100126 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\images\wd1.jpg
文件 97652 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\images\wd2.jpg
文件 15398 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\images\wd3.jpg
文件 58982 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\lunchroom_ultimate.jpg
文件 2006 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\README.md
文件 180331 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\test.jpg
文件 58838 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\test1.jpg
文件 116574 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\test12.jpg
文件 45634 2016-11-12 06:14 Python-Multiple-Image-Stitching-master\wd123.jpg
相关资源
- Instant Pygame for Python Game Development How
- Biopython Tutorial
- Think Python 2nd
- 一个小小的表白程序(python)
- Python课堂笔记(高淇400集第一季)
- 二级考试python试题12套(包括选择题和
- pywin32_python3.6_64位
- 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的视频播放器设计
评论
共有 条评论