Ask Your Question

BOWKMeansTrainer constructor

asked 2017-11-29 06:40:03 -0500

sama_z gravatar image

updated 2017-11-29 06:43:53 -0500

Hi, I have a question regarding BOWKMeansTrainer constructor. Would anyone please tell me what are the parameters of the constructor? I had a look at opencv document, but I could not find any useful information.

So far I know it has these parameters BOWKMeansTrainer::BOWKMeansTrainer(int clusterCount, const TermCriteria& termcrit=TermCriteria(), int attempts=3, int flags=KMEANS_PP_CENTERS ) And I know clusterCount is the dictionary size/number of clusters. I also guess that attempts is the K parameter for K-Mean. It means if it's 3 the trainer will calculate 3-Means/3 steps.

But I want to know what are the rests task?

Many thanks in advance,


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-11-29 07:32:27 -0500

arigarcia gravatar image


  • 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

edit flag offensive delete link more


Thanks for the comment. Could you explain more about iteration? which iteration you mean? Is this means value from each clustering level? I know so far how K-means is working, but what is K-means plus plus? What are the differences between them?

sama_z gravatar imagesama_z ( 2017-11-29 08:27:14 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-11-29 06:40:03 -0500

Seen: 74 times

Last updated: Nov 29 '17