See:
- K is clusters number in TermCriteria
you can to define iterations numbers
and rules for terminations, for
instance TermCriteria (EPS + MAX_ITER, 1000, 0.1), so when you
iteration = MAX_ITER = 1000 or epsilon = 0.1 your running will
stop
- flag KMEANS_PP_CENTERS says that will run kmean++ algorithm;
- attemps: number of initializations of the algorithm
See example in https://docs.opencv.org/3.3.0/de/d63/kmeans_8cpp-example.html#_a18.