Coder Social home page Coder Social logo

kmeans-image-segmentation's Introduction

Kmeans-Image-Segmentation

##Algorithm Overview:

  • The KMeans algorithm is an unsupervised clustering algorithm that classifies the input data points into multiple classes based on their inherent distance from each other. The algorithm assumes that the data features form a vector space and tries to find natural clustering in them.
  • The points are clustered around centroids equation The algorithm takes a 2 dimensional image as input.
  • Various steps in the algorithm are as follows:
    1. Compute the intensity distribution(also called the histogram) of the intensities.
    2. Initialize the centroids with k random intensities
    3. Repeat the following steps until the cluster labels of the image does not change anymore.
    4. Cluster the points based on distance of their intensities from the centroid intensities. equation
    5. Compute the new centroid for each of the clusters.
      equation
  • where k is a parameter of the algorithm (the number of clusters to be found), i iterates over the all the intensities,j iterates over all the centroids and µ are the centroid intensities.

Usage:

usage: kmeans_imgsegment.py [-h] -i SOURCE_IMG -k BIN_SIZE

Original Image:

original_img

Sample Output:

  • K=2 k=2
  • K=3 k=3
  • K=5 k=5
  • K=8 k=8
  • K=10 k=10

References:

kmeans-image-segmentation's People

Contributors

ntrischi avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Forkers

rubenjtl ajjumaxy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.