I am trying to extract key point and descriptors but my SURF.detectAndCompute returns None in front of the array and because of that I cannot do the clustering. Below is my code:
image_paths = []
image_group_id = []
image_group_names = os.listdir(train_path)
descriptors = []
SURF = cv2.xfeatures2d.SURF_create()
SURF.setHessianThreshold(5000)
for group_id, train_group_path in enumerate(os.listdir(train_path)):
image_path = train_path + '/' + train_group_path
for path in os.listdir(image_path):
full_image_path = image_path + '/' + path
image_paths.append(full_image_path)
image_group_id.append(group_id)
_, des = SURF.detectAndCompute(cv2.imread(full_image_path), None)
descriptors.append(des)
And this is the of the descriptors that I tried to print:
[None, array([[ 0.00140431, 0.00414569, 0.00156097, 0.00508978, -0.01072729,
0.03109567, 0.01673188, 0.04477221, -0.04659119, 0.0652261 ,
0.04661125, 0.08301401, -0.00103816, 0.0069982 , 0.00168295,
0.00876924, 0.01606237, -0.00151245, 0.01966742, 0.01294267,
-0.2951115 , -0.14716513, 0.32090443, 0.18698329, 0.21934257,
-0.02404423, 0.29070902, 0.17538053, -0.03951943, 0.02635496,
0.04406727, 0.02923489, 0.03092461, -0.04000381, 0.03236163,
0.04539306, -0.26897454, -0.112547 , 0.33476326, 0.29709056,
0.2916087 , -0.01106649, 0.351532 , 0.19272245, -0.07418256,
-0.04663706, 0.07452377, 0.04671762, 0.00109221, 0.00404389,
0.0019812 , 0.0101865 , 0.00381939, -0.01452297, 0.05944061,
0.05199388, 0.0035292 , -0.04607308, 0.03296318, 0.04701661,
-0.00757545, -0.00286426, 0.00760168, 0.00306828]],
dtype=float32)
The None isn't supposed to be there. What can I do to fix this? I am new in this field, any advice is very appreciated. Thank you!