1 | initial version |
to apply cv2.kmeans, you need a single, 2d matrix, where each row is a flattened 1d image, and convert to float:
images = np.asarray(images, np.float32) N = len(images) images = images.reshape(N,-1)
2 | No.2 Revision |
to apply cv2.kmeans, you need a single, 2d matrix, where each row is a flattened 1d image, and convert to float:
images = np.asarray(images, np.float32)
N = len(images)
images = 3 | No.3 Revision |
to apply cv2.kmeans, you need a single, 2d matrix, where each row is a flattened 1d image, and convert to float:
images = np.asarray(images, np.float32)
N = len(images)
images = images.reshape(N,-1)
also: https://github.com/opencv/opencv/blob/master/samples/python/kmeans.py