Giter Site home page Giter Site logo

image-segementation's Introduction

Image-Segementation

  • This whole program is made to extract the dominant colors of the image and then to recreate the image with those dominant colors.
  • K Means Clustering is used here to perform this task.

What is K Means Clustering ?

  • This algorithm basically follow 4 steps.
  1. It first randomly intialize centres.
  2. It computes the distance of each point from each center and associates the point to that center from which its Eucledian distance is minimum. (Euclidean Distance between two points ((x,y),(a,b)) is given as = √(x - a)² + (y - b)²)
  3. After associating all points with the centers , the value of center is changed. New value of center is the mean value of all the points associated with it. After changing all the centers , the points associated with it are removed.
  4. Step 2 is again performed and then 3 until the optimum state is reached.
  • Each center now associated with some points , now this group of points together is called cluster.

  • Image segmentation involves few steps mentioned below.
  • Reading the image --> converting it into 2D array --> Applying K Means --> Extracting the dominant colors --> Assigning these colors to new image --> Reshaping it into original size.

Example

Let say we have an image in which blue color is dominant .Each point in the image is characterized by the pixel  
and since blue color is dominant , so all the blue color point will have same pixel value. When K means clustering   
is applied , it groups all those blue color points into a cluster as these points are similar. Similary if an   
image has more than one dominant color then this algorithm group all the similar pixel points together into   
a cluster. In this way this algorithm helps to find dominant colors of an image. 

Note:

IPYNB file contains the example with code. So go through that to get better intution about this algorithm.

image-segementation's People

Contributors

m1-key avatar

Watchers

James Cloos avatar

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.