TypeError: data type not understood opencv python

asked 2015-07-29 20:52:29 -0600

shar gravatar image

thats my python3 opencv3 code i get this error when i run this code i did't finished it yet that's are the error can some one help ?

line 19, in <module> matches = bf.match(np.array(kpTrain, desTrain)) TypeError: data type not understood

that's my code

import numpy as np
import cv2


camera = cv2.VideoCapture(0)
orb = cv2.ORB_create()

img = cv2.imread('/home/shar/home.jpg')
imggray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)


kpTrain = orb.detect(imggray,None)
kpTrain, desTrain = orb.compute(imggray, kpTrain)

ret, imgCamColor = camera.read()

bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True)

matches = bf.match(np.array(kpTrain, desTrain))
edit retag flag offensive close merge delete

Comments

you need to match 2 descriptors from 2 images, not the keypoints and descriptors of the 1st image

please have another look at the matching tutorial

berak gravatar imageberak ( 2015-07-30 02:13:53 -0600 )edit