- OpenCV Python 教程
- OpenCV Python - 首頁
- OpenCV Python - 概述
- OpenCV Python - 環境
- OpenCV Python - 讀取影像
- OpenCV Python - 寫入影像
- OpenCV Python - 使用 Matplotlib
- OpenCV Python - 影像屬性
- OpenCV Python - 按位運算
- OpenCV Python - 形狀和文字
- OpenCV Python - 滑鼠事件
- OpenCV Python - 新增軌跡條
- OpenCV Python - 調整大小和旋轉
- OpenCV Python - 影像閾值
- OpenCV Python - 影像濾波
- OpenCV Python - 邊緣檢測
- OpenCV Python - 直方圖
- OpenCV Python - 顏色空間
- OpenCV Python - 變換
- OpenCV Python - 影像輪廓
- OpenCV Python - 模板匹配
- OpenCV Python - 影像金字塔
- OpenCV Python - 影像疊加
- OpenCV Python - 影像融合
- OpenCV Python - 傅立葉變換
- OpenCV Python - 捕捉影片
- OpenCV Python - 播放影片
- OpenCV Python - 影片中的影像
- OpenCV Python - 影像中的影片
- OpenCV Python - 面部識別
- OpenCV Python - 均值漂移/Camshift
- OpenCV Python - 特徵檢測
- OpenCV Python - 特徵匹配
- OpenCV Python - 數字識別
- OpenCV Python 資源
- OpenCV Python - 快速指南
- OpenCV Python - 資源
- OpenCV Python - 討論
OpenCV Python - 特徵匹配
OpenCV 提供兩種特徵匹配技術。蠻力匹配和平行特徵匹配技術。
示例
以下示例使用蠻力方法
import numpy as np
import cv2
img1 = cv2.imread('lena.jpg')
img2 = cv2.imread('lena-test.jpg')
# Convert it to grayscale
img1_bw = cv2.cvtColor(img1,cv2.COLOR_BGR2GRAY)
img2_bw = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)
orb = cv2.ORB_create()
queryKeypoints, queryDescriptors = orb.detectAndCompute(img1_bw,None)
trainKeypoints, trainDescriptors = orb.detectAndCompute(img2_bw,None)
matcher = cv2.BFMatcher()
matches = matcher.match(queryDescriptors,trainDescriptors)
img = cv2.drawMatches(img1, queryKeypoints,
img2, trainKeypoints, matches[:20],None)
img = cv2.resize(img, (1000,650))
cv2.imshow("Feature Match", img)
輸出
廣告