Ask Your Question
0

Error in BFMatcher : batch_distance

asked 2020-08-24 02:52:40 -0600

hoseinimage gravatar image

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?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2020-08-24 03:10:26 -0600

berak gravatar image

your code does not make any sense, the BruteForce Matcher is for matching descriptors (e.g. ORB or SIFT), not pointlists

please have another look at the tutorials

edit flag offensive delete link more

Comments

hi thanks Berak for your guides, so Bruteforce Matcher cant use for Shi-Tomasi Detector?

hoseinimage gravatar imagehoseinimage ( 2020-08-25 00:09:04 -0600 )edit

hi Mr Berak, Thanks a lot, i used ORB without any error.

hoseinimage gravatar imagehoseinimage ( 2020-08-25 00:37:57 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-08-24 02:52:40 -0600

Seen: 7,023 times

Last updated: Aug 24 '20