Opencv-python. How can I use convertTo?

brisk = cv2.BRISK_create()
des = brisk.compute(img,kp, None)
des.convertTo(des_left,cv2.CV_32F)

> AttributeError: ‘tuple’ object has no attribute ‘convertTo’

or

des = des[1].convertTo(des,cv2.CV_32F)

> AttributeError: ‘numpy.ndarray’ object has no attribute ‘convertTo’

How can I use convertTo in opencv-python? Sincerely hope to get your help.

use numpy astype

please explain, WHY you try to do this.

there is no meaningful conversion to float from binary descriptors (BRISK,ORB,etc), those are bitstrings , not numbers

again, please explain the context, seems you try to blindly copypaste a broken idea :wink:

I want to try fast detector+brisk descriptor+flann matching, and I found the brisk descriptor don’t fit the input type. After googling , I found someone recommend to use convertTo to make it possible. I tried, but convertTo seems to not included in the opencv-python(contrib), so I came here to ask :rofl:.

By the way, if I achieve the convertTo, do the matching outcomes meaningful? Or bfmatch will be a better choice?

no way. the result is just garbage.

keep the descriptors as-is (uint8) and match them with BFMatcher (HAMMING), or . IF you need to use flann, use an LSHIndex:

FLANN_INDEX_LSH = 6

index_params= dict(algorithm = FLANN_INDEX_LSH,
                   table_number = 6, # 12
                   key_size = 12,     # 20
                   multi_probe_level = 1) #2
search_params = dict(checks=50)   # or pass empty dictionary

flann = cv2.FlannBasedMatcher(index_params,search_params)