TypeError: Incorrect type of self (must be 'DescriptorMatcher' or its derivative) with ORB_create()

51 Views Asked by At

I would like to compute the homography matrix using cv2. For that, I was using ORB_create() first and followed the discussion in How would I use Orb detector with image homography?.

However, while doing matches = bf.match(descs1, descs2), I am getting an error

File "/var/folders/_s/sk0g6rrx3_v_fl0y8zybdb8c0000gn/T/ipykernel_32180/2073887229.py", line 2, in <module>
    matches = bf.match(descs1, descs2)

TypeError: Incorrect type of self (must be 'DescriptorMatcher' or its derivative)

What causes this issue and how can I resolve it?

EDIT

Here is the part that worked for me:

MIN_MATCH_COUNT = 20
kpts1, descs1 = orb.detectAndCompute(img1,None)
kpts2, descs2 = orb.detectAndCompute(img2,None)

## match descriptors and sort them in the order of their distance
bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True)
matches = bf.match(descs1, descs2)

img1 and img2 are grayscale images and type of numpy array of shape 128x128. After bf.match I am getting the error above.

0

There are 0 best solutions below