2024-09-30 02:18:56 发布
网友
这是我的python3opencv3代码,当我运行这个代码时,我得到了这个错误,我还没有完成它,这就是错误,有人能帮助吗?在
line 19, in <module> matches = bf.match(np.array(kpTrain, desTrain)) TypeError: data type not understood
这是我的准则
在这里,就像在这个question中一样,您试图匹配一个图像中的关键点和描述符。描述符的匹配是用两个图像完成的。 1在2张图像中查找关键点 2计算两幅图像的描述符 三。进行匹配。在
你的情况应该是这样的:
import numpy as np import cv2 orb = cv2.ORB_create() img = cv2.imread('/home/shar/home.jpg') imggray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # load second image in grayscale imggray2=cv2.imread('/path/to/image.jpg',0) #Detector and descriptors for 1st image kpTrain = orb.detect(imggray,None) kpTrain, desTrain = orb.compute(imggray, kpTrain) #Detector and descriptors for 2nd image kpTrain2 = orb.detect(imggray2,None) kpTrain2, desTrain2 = orb.compute(imggray2, kpTrain2) bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True) matches = bf.match(desTrain,desTrain2)
在这里,就像在这个question中一样,您试图匹配一个图像中的关键点和描述符。描述符的匹配是用两个图像完成的。
1在2张图像中查找关键点
2计算两幅图像的描述符
三。进行匹配。在
你的情况应该是这样的:
相关问题 更多 >
编程相关推荐