Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

BOWKMeansTrainer cluster Python issue

Hello all,

I'm trying to use cluster from the BOWKMeansTrainer class on python. Here's a snippet of code to give you an idea

sift = cv2.SIFT() print names_path

descriptors_unclustered = []

for p in training_paths:
    image = cv2.imread(p)
    gray = cv2.cvtColor(image, cv2.CV_LOAD_IMAGE_GRAYSCALE)
    kp, dsc= sift.detectAndCompute(gray, None)
    descriptors_unclustered.append(dsc)
     dictionarySize = 5

desc = np.empty(len(descriptors_unclustered), dtype=object) for i in range(len(descriptors_unclustered)):
    desc[i] = descriptors_unclustered[i]

print desc BOW = cv2.BOWKMeansTrainer(dictionarySize)

dictionary = BOW.cluster(desc)

print dictionary

I'm getting the error

TypeError: descriptors data type = 17 is not supported

When passing my numpy array to clusters(). Any idea what causes this, or what data type it's supposed to accept?