{"id":20526538,"url":"https://github.com/nikvoronin/k-means-plus-plus","last_synced_at":"2026-04-17T06:33:25.854Z","repository":{"id":254019711,"uuid":"844070697","full_name":"nikvoronin/k-means-plus-plus","owner":"nikvoronin","description":"Multithreaded K-Means and K-Means++ clustering algorithms with multidimensional vectors. Charged with example of image palette extraction.","archived":false,"fork":false,"pushed_at":"2024-08-21T18:04:03.000Z","size":41,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-25T20:13:50.113Z","etag":null,"topics":["accent-colors","clustering-algorithm","csharp","dominant-colors","dotnet","image-palette","image-processing","k-means","k-means-clustering"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nikvoronin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-18T09:41:08.000Z","updated_at":"2024-08-21T18:04:07.000Z","dependencies_parsed_at":"2024-08-21T21:33:09.584Z","dependency_job_id":null,"html_url":"https://github.com/nikvoronin/k-means-plus-plus","commit_stats":null,"previous_names":["nikvoronin/k-means-plus-plus"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nikvoronin/k-means-plus-plus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikvoronin%2Fk-means-plus-plus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikvoronin%2Fk-means-plus-plus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikvoronin%2Fk-means-plus-plus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikvoronin%2Fk-means-plus-plus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nikvoronin","download_url":"https://codeload.github.com/nikvoronin/k-means-plus-plus/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikvoronin%2Fk-means-plus-plus/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31918571,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"online","status_checked_at":"2026-04-17T02:00:06.879Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["accent-colors","clustering-algorithm","csharp","dominant-colors","dotnet","image-palette","image-processing","k-means","k-means-clustering"],"created_at":"2024-11-15T23:14:37.548Z","updated_at":"2026-04-17T06:33:25.831Z","avatar_url":"https://github.com/nikvoronin.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Multithreading K-Means++ algorithm\n\n--with multidimensional vectors.\n\n[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.\n\n## K-Means Processor\n\n- ProcessorOptions\n    - ThreadCount\n    - Number of iterations\n- VectorN\\\u003cT\\\u003e\n- KmCluster\n    - Centroid\n- IKmInitializer\n    - Simple\n    - K++\n- IDistanceEstimator\n    - Euclidean, +Root\n    - Chebyshev\n    - Manhattan\n\n`VectorN\u003cT\u003e` where `T` is an any numeric C# type such as integer or floating point, byte, int, double, decimal, etc.\n\n## Im Palette Extractor\n\n||||\n|:---:|:---:|:---:|\n|\u003cimg width=250 src=\"https://github.com/user-attachments/assets/06fb9fbc-26c7-4ab6-a85a-ff1d10631a3f\"\u003e|\u003cimg width=250 src=\"https://github.com/user-attachments/assets/e29dd6ea-5072-4748-b8be-53e51fe64124\"\u003e|\u003cimg width=250 src=\"https://github.com/user-attachments/assets/36878586-f5c3-438d-8aba-f39e1ec4c95c\"\u003e|\n|\u003cimg width=250 src=\"https://github.com/user-attachments/assets/a54fa91a-9af4-4b44-ab8b-a9d1efc728ee\"\u003e|\u003cimg width=250 src=\"https://github.com/user-attachments/assets/89cfb474-f6d4-4fe9-aecc-05e696204e3c\"\u003e|\u003cimg width=250 src=\"https://github.com/user-attachments/assets/66dd7a8f-c9da-41bb-bf46-6888150d245e\"\u003e|\n|\u003cimg width=250 src=\"https://github.com/user-attachments/assets/99744581-e937-44d6-874b-a71c1f129b9d\"\u003e|\u003cimg width=250 src=\"https://github.com/user-attachments/assets/5636986d-7d3b-4e0f-a605-4f9d6d02258e\"\u003e|\u003cimg width=250 src=\"https://github.com/user-attachments/assets/26899da7-af1c-4641-8c5c-36ccc4e6dbb3\"\u003e|\n\nExample of console output: _(the values are close to images above but not actual)_\n\n```plain\nVectors base type = Double\nNumber of threads = 8\nMax iterations = 1000\nConvergence epsilon = 0.1\nClusters initializer = KppInitializer`1\nDistance estimator = EuclideanDistance`1\n\napod20240814.jpeg\n  Size: 4855x3237px, downscaled to 400x266px.\n  Found in 3.654s\n  Cluster 0: 28077 points\n  Cluster 1: 17226 points\n  Cluster 2: 3737 points\n  Cluster 3: 6950 points\n  Cluster 4: 19334 points\n  Cluster 5: 5607 points\n  Cluster 6: 3494 points\n  Cluster 7: 5331 points\n  Cluster 8: 6046 points\n  Cluster 9: 10598 points\n  Colors: #322934; #493745; #7A5A4C; #81436C; #140F08; #815866; #B96788; #AD4A91; #BA8B87; #613C55\nbing000.jpeg\n  Size: 3840x2160px, downscaled to 400x225px.\n  Found in 4.091s\n  Cluster 0: 14070 points\n  Cluster 1: 5400 points\n  Cluster 2: 8556 points\n  Cluster 3: 5607 points\n  Cluster 4: 12713 points\n  Cluster 5: 10196 points\n  Cluster 6: 13601 points\n  Cluster 7: 5211 points\n  Cluster 8: 6117 points\n  Cluster 9: 8529 points\n  Colors: #2F2C4D; #B9532C; #504385; #733B36; #1C1A1E; #9088C8; #594C64; #8D824A; #CFCCEC; #474838\n  ...\nwikipedia20240814.jpeg\n  Size: 8256x5504px, downscaled to 400x266px.\n  Found in 2.088s\n  Cluster 0: 1816 points\n  Cluster 1: 46070 points\n  Cluster 2: 7794 points\n  Cluster 3: 5663 points\n  Cluster 4: 2834 points\n  Cluster 5: 8727 points\n  Cluster 6: 14064 points\n  Cluster 7: 2627 points\n  Cluster 8: 15491 points\n  Cluster 9: 1314 points\n  Colors: #7A7328; #787873; #D7761D; #C1401A; #B0AA40; #CBB9A2; #A3A19B; #682814; #F9B139; #A18675\n```\n\n## References\n\n- [k-means clustering](https://en.wikipedia.org/wiki/K-means_clustering). Wikipedia\n- [StefanoT/KMeans](https://github.com/StefanoT/KMeans). Simple implementation of K-Means and K-Means++ algorithms in C#\n- [kubamaruszczyk1604/KMeansCSharp](https://github.com/kubamaruszczyk1604/KMeansCSharp). C# implementation of k-means-clustering algorithm.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikvoronin%2Fk-means-plus-plus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikvoronin%2Fk-means-plus-plus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikvoronin%2Fk-means-plus-plus/lists"}