Skip to content

DeanZi/ex1_ml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ex1_ml

K-Means for Image Compression

This is a Python implementation of K-means algorithm for image compression. Given an input image and initial clusters, the algorithm compresses the image.

Dependencies

The code depends on the following Python packages:

  • NumPy
  • Matplotlib

Usage Example

Here is an example command to run the algorithm on an input image with 3 clusters:

python3 ex1.py dog.jpeg cents3.txt output.txt

The compressed image will be saved in the compressed_dog.jpeg file, the centroids for each iteration until convergence in output.txt.

Author

This code was written by DeanZi as part of a university programming project. Feel free to use and modify it as you like.

About

K-Means for Image Compression

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages