diff --git a/docs/examples/image_segmentation/assets/p1.png b/docs/examples/image_segmentation/assets/p1.png new file mode 100644 index 00000000..3b62f77d Binary files /dev/null and b/docs/examples/image_segmentation/assets/p1.png differ diff --git a/docs/examples/image_segmentation/assets/p2.png b/docs/examples/image_segmentation/assets/p2.png new file mode 100644 index 00000000..583c0398 Binary files /dev/null and b/docs/examples/image_segmentation/assets/p2.png differ diff --git a/docs/examples/image_segmentation/assets/p3.png b/docs/examples/image_segmentation/assets/p3.png new file mode 100644 index 00000000..7987b0f2 Binary files /dev/null and b/docs/examples/image_segmentation/assets/p3.png differ diff --git a/docs/examples/image_segmentation/fuzzycmeans.jl b/docs/examples/image_segmentation/fuzzycmeans.jl new file mode 100644 index 00000000..3f9ae7aa --- /dev/null +++ b/docs/examples/image_segmentation/fuzzycmeans.jl @@ -0,0 +1,76 @@ +# --- +# cover: assets/fuzzycmeans.gif +# title: Fuzzy C-Means +# description: This demo shows how to use the fuzzy c-means algorithm to segment an image. +# author: Ashwani Rathee +# date: 2021-09-22 +# --- + +# Fuzzy C-means clustering is widely used for unsupervised image segmentation. It is an +# iterative algorithm which tries to minimize the cost function: + +# +# $J = \displaystyle\sum_{i=1}^{N} \sum_{j=1}^{C} \delta_{ij} \| x_{i} - c_{j} \|^2$ +# + +# Unlike K-means, it allows pixels to belong to two or more clusters. It is widely used +# for medical imaging like in the soft segmentation of brain tissue model. +# Note that both Fuzzy C-means and K-means have an element of randomness, and it's possible +# to get results that vary considerably from one run to the next. + +# Fuzzy C-Means clustering is a soft clustering approach, where each data point is assigned +# a likelihood or probability score to belong to that cluster. + +# The step-wise approach of the Fuzzy c-means clustering algorithm is: +# - Fix the value of c (number of clusters), and select a value of m (generally 1.25