Difference between EmguCV kmeans and Python OpenCV kmeans #716
Unanswered
juacamgo93
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I am working on a project and I need to do some color quantization to get dominant colors.
I researched about the kmeans clustering and developed the algorithm in Python (it works well) and then translated to C# using EmguCV.
I managed to translate the algorithm to EmguCV and it works well, but there's something that worries me.
In Python's OpenCV, when doing the kmeans clustering for example with
k=3, I get 3 colors and the first one (centers[0]) is the dominant color. In fact, the colors are ordered from dominant to less, and I can verify this by executing the algorithm again and again over the same image, and check that the colors detected are (more or less) the same and in the same order.But that's not the case with EmguCV, and I don't know if maybe it could be an OpenCV issue, or an issue of EmguCV.
In EmguCV if I execute the algorithm and for example, I get this three colors as result: [ (180, 180, 180), (100, 100, 100), (40, 40, 40)], the first one should be the dominant color (based on the results of Python implementation), but it's not the case.
If I execute the algorithm again, I will obtain the same (more or less) colors, but maybe in other order.
Could be a problem with OpenCV or with the EmguCV wrapper?
Beta Was this translation helpful? Give feedback.
All reactions