OpenCV4Android Kmean doesn't work as expected
问题 This code should give centers mat with 3 rows and clusterCount number of columns Mat reshaped_image = imageMat.reshape(1, imageMat.cols()*imageMat.rows()); Mat reshaped_image32f = new Mat(); reshaped_image.convertTo(reshaped_image32f, CvType.CV_32F, 1.0 / 255.0); Mat labels = new Mat(); TermCriteria criteria = new TermCriteria(TermCriteria.COUNT, 100, 1); Mat centers = new Mat(); int clusterCount = 5, attempts = 1; Core.kmeans(reshaped_image32f, clusterCount, labels, criteria, attempts, Core