JuliaImages / ImageSegmentation.jl

Partitioning images into meaningful regions
Other
47 stars 23 forks source link

Clustering based segmentation #11

Closed annimesh2809 closed 7 years ago

annimesh2809 commented 7 years ago

An implementation of the standard fuzzy c-means algorithm as stated in this paper. This implementation requires input to be of a similar form as that required by k-means in Clustering.jl. A wrapper has been written for images and works for general N-dimensional offset images. The output is a tuple of membership weights and segment centers. Tests and doc will be added soon.

Demo: Original image: org

Applying fuzzy cmeans on image with C = 4, eps_ = 0.001 and fuzziness = 1.8 c1 c2 c3 c4

Original: so

Applying fuzzy cmeans with C = 4, eps_ = 0.002 and fuzziness = 1.8 si

codecov[bot] commented 7 years ago

Codecov Report

Merging #11 into master will decrease coverage by 0.99%. The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #11   +/-   ##
=======================================
- Coverage   99.39%   98.39%   -1%     
=======================================
  Files           8        9    +1     
  Lines         494      499    +5     
=======================================
  Hits          491      491           
- Misses          3        8    +5
Impacted Files Coverage Δ
src/ImageSegmentation.jl 100% <ø> (ø) :arrow_up:
src/clustering.jl 0% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 70155ee...5959ce1. Read the comment docs.

annimesh2809 commented 7 years ago

The output of this implementation is a tuple (weights, centers). weight[pix][Ci] denotes the membership of pixel with "linear index" pix in the class with index Ci. So, even in the case of offset images we can directly use parent(img) because we are working with linear indices. I have changed the code accordingly.

annimesh2809 commented 7 years ago

I will send a PR to Clustering.jl for the core algorithm once you approve the changes.

timholy commented 7 years ago

LGTM!

annimesh2809 commented 7 years ago

I have written wrappers for both kmeans and fuzzycmeans that dispatch over the functions from Clustering.jl.