Ask Your Question

Revision history [back]

Error in BFMatcher : batch_distance

hi i wrote these codes for detect corner features using Shi-Tomasi and used Bruteforce Matcher for Match features between two images.

 cap = cv2.imread('mario.png', 0)
 model = cv2.imread('mario 3d.jpg', 0)
 corners1 = cv2.goodFeaturesToTrack(cap, 20, 0.01, 10)
 corners2 = cv2.goodFeaturesToTrack(model, 20, 0.01, 10)
 corner1 = np.int0(corners1)
 corner2 = np.int0(corners2)
 bf = cv2.BFMatcher(cv2.NORM_L2, crossCheck=False)
 matches = bf.match(corners1, corners2)

but Pycharm 2020 gives this Error:

matches = bf.match(corners1, corners2)

cv2.error: OpenCV(4.4.0) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-cff9bdsm\opencv\modules\core\src\batch_distance.cpp:275: error: (-215:Assertion failed) type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U) in function 'cv::batchDistance'

I used Python 3 and Opencv-python 4.4.0.42 and Opencv-contrib-python with Same Version exactly

Please Help me How to fix it?