import cv2 as cv
import os
path1=r'E:\sceneflow\driving\frames_finalpass\15mm_focallength\scene_backwards\fast\left\0001.png'
path2=r'E:\sceneflow\driving\frames_finalpass\15mm_focallength\scene_backwards\fast\right\0001.png'
img1=cv.imread(path1,1)
img2=cv.imread(path2,1)
orb = cv.ORB_create ()
keypoints1= orb.detect(img1, None)
keypoints2= orb.detect(img2, None)
keypoints1,desriptors1=orb.compute(img1,keypoints1)
keypoints2,desriptors2=orb.compute(img2,keypoints2)
print(desriptors1.shape,img1.shape)
print(desriptors2.shape,img2.shape)
outimg=None
outimg=cv.drawKeypoints(img1,keypoints1,outimg)
# cv.imshow("desriptor",outimg)
matcher=cv.BFMatcher()
matches=None
matches=matcher.match(desriptors1,desriptors2,matches)
min_dist=10000
max_dist=0
for i in range(len(desriptors1[0])):
dist = matches[i].distance
if dist < min_dist:
min_dist = dist
if dist > max_
ORB检测
最新推荐文章于 2024-04-22 19:59:20 发布