Skip to content

portoaj/image-processing-kmeans

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Image Processing with K-Means

The KMeans class takes an image, clusters it using the K-Means algorithm and gives a variety of outputs. It also includes an elbow method implementation for automatically choosing the optimal number of clusters(K).

Usage

1.Run the jupyter notebook (imageprocessingkmeans.ipynb) and upload an image and the kmeans class OR

  1. Import KMeans
from kmeans import KMeans
  1. Initialize a KMeans class with 3 dimensions(R,G,B)
km = KMeans(3)
  1. Use elbow method to find optimal K value
km.k, km.inertias = km.elbow(<maxK>, <maxIterations>, <filePath>)
#Or set km.k manually without using the elbow method

4.Train the model

km.train(<maxIterations>)

5.Generate desired output

#Use any of the following
km.graphInertias()
km.outputGraph()
km.outputImage()
km.outputImageAlternate()

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published