okaneco / kmeans-colors

k-means clustering library and binary to find dominant colors in images
Apache License 2.0
134 stars 9 forks source link

Implement the triangle inequality optimization #1

Closed okaneco closed 4 years ago

okaneco commented 4 years ago

This should speed up the calculation since it eliminates some of the distance checks.

It would be nice to add benchmarks with this change to see the difference.

okaneco commented 4 years ago

Deleted a comment where I mentioned the reasoning for setting Hamerly versus Lloyd's for the binary. With the addition of kmeans++, the comment is no longer valid.