Skip to content

This repo contains the Implementation of K-Means Clustering Algorithm from scratch and an Image Segmentation Project, implemented using the same algorithm.

Notifications You must be signed in to change notification settings

deepanshu-Raj/K-Means-Agorithm-Implementation

Repository files navigation

K-Means Agorithmic Implementation

k-means clustering is a method of vector quantization, originally from signal processing, that aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean (cluster centers or cluster centroid), serving as a prototype of the cluster.

Content

  • Code for K-means Algorithm implemented from scratch in Python 3 : Here
  • Cases where K-means algorithm Fails : Here
  • Application of K-means algorithm in Image Segmentation : Here

Application : Image Segmentation

Using K-means algorithm, I have extracted the K most dominant colour of the image, Where k is the input received from User. It is a basic application of the K-Means algorithm, where, the algorithm tries to find out K-most dominant colours, in the pixel array, and then the new or modified picture is created by replacing the nearest colour value, among the k most dominant colours, to give a completely new image made up of, these colours.

Image Segmentation Demo

NOTE :

I have used K (no. of dominant colours to extract) = 6 but the program is generic, and you can give any positive integer upto 255 to it.

Authors

About

This repo contains the Implementation of K-Means Clustering Algorithm from scratch and an Image Segmentation Project, implemented using the same algorithm.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published