This Python module performs K-means clustering on an image to segment it into a specified number of clusters.
You can install the module via pip:
pip install huehush==0.0.2
from huehush import cluster_image
# Example usage:
cluster_image('input_image.jpg', num_clusters=5, save_path='clustered_image.jpg')
The cluster_image
function takes an input image, the number of clusters (K) to create, and an optional path to save the resulting clustered image. It applies K-means clustering to the colors in the image, replacing each pixel's color with the nearest cluster center.
Here's an example of using cluster_image
function:
cluster_image('input_image.jpg', num_clusters=5, save_path='clustered_image.jpg')
This would read the 'input_image.jpg', perform K-means clustering with 5 clusters, and save the resulting clustered image as 'clustered_image.jpg'.
This project is licensed under the Apache License - see the LICENSE file for details.
https://pypistats.org/packages/huehush
Aravind.M.S