Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nikvoronin/k-means-plus-plus
Multithreaded K-Means and K-Means++ clustering algorithms with multidimensional vectors. Charged with example of image palette extraction.
https://github.com/nikvoronin/k-means-plus-plus
accent-colors clustering-algorithm csharp dominant-colors dotnet image-palette image-processing k-means k-means-clustering
Last synced: about 1 month ago
JSON representation
Multithreaded K-Means and K-Means++ clustering algorithms with multidimensional vectors. Charged with example of image palette extraction.
- Host: GitHub
- URL: https://github.com/nikvoronin/k-means-plus-plus
- Owner: nikvoronin
- License: mit
- Created: 2024-08-18T09:41:08.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-08-21T18:04:03.000Z (4 months ago)
- Last Synced: 2024-08-21T23:46:13.223Z (4 months ago)
- Topics: accent-colors, clustering-algorithm, csharp, dominant-colors, dotnet, image-palette, image-processing, k-means, k-means-clustering
- Language: C#
- Homepage:
- Size: 40 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Multithreading K-Means++ algorithm
--with multidimensional vectors.
[Vector-3](https://github.com/nikvoronin/k-means-plus-plus/tree/vector-3) branch contains simple but more efficient version of image palette extraction. It is using `System.Numerics.Vector3` type and applied in [The Last Wallpaper](https://github.com/nikvoronin/LastWallpaper/tree/main/LastWallpaper/Logic/KMeans) project to make colored mosaic tray icons.
## K-Means Processor
- ProcessorOptions
- ThreadCount
- Number of iterations
- VectorN\
- KmCluster
- Centroid
- IKmInitializer
- Simple
- K++
- IDistanceEstimator
- Euclidean, +Root
- Chebyshev
- Manhattan`VectorN` where `T` is an any numeric C# type such as integer or floating point, byte, int, double, decimal, etc.
## Im Palette Extractor
||||
|:---:|:---:|:---:|
||||
||||
||||Example of console output: _(the values are close to images above but not actual)_
```plain
Vectors base type = Double
Number of threads = 8
Max iterations = 1000
Convergence epsilon = 0.1
Clusters initializer = KppInitializer`1
Distance estimator = EuclideanDistance`1apod20240814.jpeg
Size: 4855x3237px, downscaled to 400x266px.
Found in 3.654s
Cluster 0: 28077 points
Cluster 1: 17226 points
Cluster 2: 3737 points
Cluster 3: 6950 points
Cluster 4: 19334 points
Cluster 5: 5607 points
Cluster 6: 3494 points
Cluster 7: 5331 points
Cluster 8: 6046 points
Cluster 9: 10598 points
Colors: #322934; #493745; #7A5A4C; #81436C; #140F08; #815866; #B96788; #AD4A91; #BA8B87; #613C55
bing000.jpeg
Size: 3840x2160px, downscaled to 400x225px.
Found in 4.091s
Cluster 0: 14070 points
Cluster 1: 5400 points
Cluster 2: 8556 points
Cluster 3: 5607 points
Cluster 4: 12713 points
Cluster 5: 10196 points
Cluster 6: 13601 points
Cluster 7: 5211 points
Cluster 8: 6117 points
Cluster 9: 8529 points
Colors: #2F2C4D; #B9532C; #504385; #733B36; #1C1A1E; #9088C8; #594C64; #8D824A; #CFCCEC; #474838
...
wikipedia20240814.jpeg
Size: 8256x5504px, downscaled to 400x266px.
Found in 2.088s
Cluster 0: 1816 points
Cluster 1: 46070 points
Cluster 2: 7794 points
Cluster 3: 5663 points
Cluster 4: 2834 points
Cluster 5: 8727 points
Cluster 6: 14064 points
Cluster 7: 2627 points
Cluster 8: 15491 points
Cluster 9: 1314 points
Colors: #7A7328; #787873; #D7761D; #C1401A; #B0AA40; #CBB9A2; #A3A19B; #682814; #F9B139; #A18675
```## References
- [k-means clustering](https://en.wikipedia.org/wiki/K-means_clustering). Wikipedia
- [StefanoT/KMeans](https://github.com/StefanoT/KMeans). Simple implementation of K-Means and K-Means++ algorithms in C#
- [kubamaruszczyk1604/KMeansCSharp](https://github.com/kubamaruszczyk1604/KMeansCSharp). C# implementation of k-means-clustering algorithm.