资源简介
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
相关资源
- python 截图 抓图 源码
- 量化交易之路用Python做股票量化分析
- 用Python写网络爬虫.pdf 高清带书签
- 基于OpenCV 的回转体零件表面缺陷检测
- Django-ERP-for-python3.6-django2.1.2
- 原生python ctp
- UHD+GNURadio安装工具 Python脚本以及安装
- Python 数据分析之金融欺诈行为检测
- Python 学习笔记 第二版.pdf
- python 2.7 pip安装
- TBCNN 源码
- 车牌号码识别python+opencv
- python for information
- Ubuntu18.04LTS下安装 Caffe-GPU版本及 Ana
- 精通Python设计模式.pdf 清晰中文完整版
- learn-python-the-hard-way中文版
- Python3官方手册中文版
- XGBoost with Python (book + complete code fo
- 基于Python的微信自动回复机器人
- 500 line or less最新版
- Python Odoo企业级开发实战
- python学生管理系统.zip
- 根据关键字爬虫谷歌、百度、必应图
- PCA 算法实验代码python
- Text.Analytics.with.Python
- python版植物大战僵尸源码
- python的计量经济学
- 人体姿态检测
- Python for Data Analysis 2nd Edition 英文高清
- faster rcnn(python+caffe)源代码
评论
共有 条评论