我使用opencv 3.0.0和python 2.7.5_x32
这是我的代码(ORB_feature_detection):
import numpy as np
import cv2
from matplotlib import pyplot as plt
img1 = cv2.imread('C:\\Python27\\madar1.jpg',0) # queryImage
img2 = cv2.imread('C:\\Python27\\madar2.jpg',0) # trainImage
# Initiate SIFT detector
orb = cv2.ORB_create()
# line 12
# find the keypoints and descriptors with SIFT
kp1, des1 = orb.detectAndCompute(img1,None)
kp2, des2 = orb.detectAndCompute(img2,None)
# create BFMatcher object
bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True)
# Match descriptors.
matches = bf.match(des1,des2)
# Sort them in the order of their distance.
matches = sorted(matches, key = …Run Code Online (Sandbox Code Playgroud)