python 3.6.1 opencv3
flags=cv2.KMEANS_RANDOM_CENTERS
retval, bestLabels, codebook = cv2.kmeans (features, self.codebookSize, None, term_crit, iterMax, flags)
self.classifier.train(codebook, np.arry(range(self.codebookSize)))
codebook=cv2.kmeans (features, self.codebookSize, None, term_crit, itaMax, flags)
type error: data data type = 17 is not supported
I think the cv2.kmeans parameter is correct, but I would appreciate it if you could let me know how to avoid the error.
opencv python3
In OpenCV, data type=17
means CV_8SC3
type, which means that there are three channels of signed 8-bit char.
For the cv2.kmeans
document allows matrix elements as arguments for this function to be either CV_32F
or CV_32FC2
.Therefore, this program requires that the variable features
be of type to one of these. Use features.shape
or features.dtype
to determine the matrix and element types.
cv::kmeans
--OpenCV3.2.0
© 2024 OneMinuteCode. All rights reserved.