Skip to content

Instantly share code, notes, and snippets.

View nedaresa's full-sized avatar

Neda Jabbari nedaresa

View GitHub Profile
@nedaresa
nedaresa / get_dominant_color.py
Last active October 31, 2024 21:09
Detecting the dominant color in an image
### Neda Jabbari
### Jan 8, 2020
### The get_dominant_color function detects dominant color from an image using a dictionary of basic colors,
### k-means clustering and eucledian distance.
def get_dominant_color(image, k, image_processing_size):
"""
Read and prepare image in RGB color space.
Perform kmeans clustering to get color clusters.