Skip to content

Commit d8acca5

Browse files
committed
Add BLOG.md
1 parent d864b8a commit d8acca5

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
.idea
22
vendor/
3-
image-clustering
3+
4+
# binaries
5+
image-clustering
6+
bin/
7+
current

BLOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Image clustering in Go
2+
3+
The _image-clustering_ program partitions the pixel in an image
4+
based on their color to a pre-defined number of clusters.
5+
Each cluster is a random color assigned. The resulting image
6+
will represent each pixel in its corresponding cluster-color.
7+
8+
9+
#### Example
10+
11+
original | result with 10 clusters
12+
:-------------------------:|:-------------------------:
13+
![](data/img3.png) | ![](data/img3_c10.png)
14+
15+
16+
### K-Means Clustering
17+
18+
To achieve this we use __K-Means Clustering__, an iterative algorithm to partition a set
19+
of data points (here colors) into a pre-defined number (k) of clusters.
20+
21+
The algorithm starts by assigning each cluster a randomly created centroid.
22+
The centroid is the _"average"_ of the points in the cluster.<br>
23+
After we assigned each pixel based on their color
24+
to the cluster with nearest centroid, we recompute the centroids
25+
by assigning them to the average of their members.
26+
This two steps are repeated until the centroids converged.

data/img3.png

1.42 MB
Loading

data/img3_c10.png

129 KB
Loading

0 commit comments

Comments
 (0)