Python. Compute keypoints and descriptor with multiple images
I'm trying to compute keypoints and descriptors for a given set of images with cv2.xfeatures2d.SIFT. I want to create an array with all keypoints from every images and another array for descriptors too:
kp = numpy.empty([])
dsc = numpy.empty([])
for imagesFiles in range(0, len(imagesCoast)):
sift = cv2.xfeatures2d.SIFT_create()
kp[imagesFiles], dsc[imagesFiles] = sift.detectAndCompute(imagesCoast[imagesFiles], None)
When I run it, output says:
keypts[imagesFiles], descriptor[imagesFiles] = `sift.detectAndCompute(imagesCoast[imagesFiles], None)`IndexError: 0-d arrays can't be indexed
What I'm doing wrong? If I delete [imagesFiles]
from kp
and dsc
it computes everything for each imagesFiles
, but them only keeps keypoits and descriptor for last one? I would like to know also, what does mean IndexError: 0-d arrays
Thanks in advance José Soto