berak / opencv_smallfry

it did not fit anywhere else ..
Other
57 stars 26 forks source link

number of Centroids is 0 when maxIterations > 0 #2

Closed RadovanF closed 6 years ago

RadovanF commented 6 years ago

Hi,

first of all, i would like to thank for your source codes. However, the kmajority works (for me) when the maxIterations = 0. In the case that the maxIterations > 0 and the computeCentroids method is called, the elements of return centroids matrix are zero.

Do I somethings wrong?

Many thanks and Best regards, midwej

berak commented 6 years ago

thanks for your feedback, let me enquire .. (when in doubt, assume, that the error is on my side !)

i might have broken something, taking the code from here

berak commented 6 years ago

bug confirmed ;) i never realized, i assumed, the TermCriteria had some sensible default. (that's bug #1)

this must have rows, not cols., see commit (apologies, commit is pretty noisy)

RadovanF commented 6 years ago

With rows, the source code looks like it works. Thanks for your fast reply.

berak commented 6 years ago

nice to hear that !

just curious, what are you doing with it ?

RadovanF commented 6 years ago

At this moment I am working on recognition of driver behavior inside the car cockpit. I know how to use SIFT, SURF with BoW model combined with opencv. However, I would like to explore binary features (e.g. ORB, BRIEF) and comprate the binary features with SURF, SIFT using BoW for my scientific work. I started with hierarchical clustering and Hamming distance, unfortunately there is bug in opencv and kmajority method is a next possibility.

If you are interested in my work (or if you have some scientific papers related to the object recognition/detection) please do not hesitate to contact me.

berak commented 6 years ago

best of luck with it ;)