How to use kmeans of opencvjs, you can give a sampl?Tks
My code can’t display the quantized results correctly
let canvas = document.getElementById('kmeans')
let mat=cv.imread(canvas);
cv.cvtColor(mat,mat,cv.COLOR_BGR2Lab, 0);
let sample= new cv.Mat(mat.rows * mat.cols, 4, cv.CV_32F)
let labels = new cv.Mat();
let centers = new cv.Mat();
let criteria= new cv.TermCriteria(cv.TermCriteria_EPS + cv.TermCriteria_MAX_ITER, 10,1.0)
cv.kmeans(sample,14, labels, criteria, 10, cv.KMEANS_RANDOM_CENTERS, centers );
console.log('sample',sample)
console.log('labels',labels)
console.log('centers',centers)
cv.imshow('kmeans',labels);