Home

Image Quantization (K means clustering)

state-of-the-art parameter tuning

Original
Result
source image

Parameters

K

Number of clusters to split the set by. Basically, it specifies the number of colors of the resulting image.

Criteria

Specifies when to terminate the algorithm. That is, the maximum number of iterations and/or the desired accuracy. Accuracy is specified as Epsilon while max iteration as Max Iteration.

Type

Max Iteration

Epsilon

Attempts

The number of times the algorithm is executed using different initial settings.

Initial

Initialization of starting points. Check out the documentation for further information on each type. The flag cv2.KMEANS_USE_INITIAL_LABELS is excluded here for simplicity.

Code

Reference


*Disclaimer*: This site is not in any way associated with the OpenCV organization. Visit OpenCV.org for an updated documentation for the latest functions.

This site is built on the sheer annoyance and repetitive frustration the author experienced while tuning parameters on OpenCV. It is casually maintained in my spare time. You can DM me on Github for any feature suggestions.

© 2020~ Yu-Kai Wang

@Github