|
|
--- |
|
|
license: unknown |
|
|
--- |
|
|
--- |
|
|
language: en |
|
|
pipeline_tag: image-classification |
|
|
task: Image Color Extraction |
|
|
--- |
|
|
|
|
|
# Image Color Extraction Model |
|
|
|
|
|
This model performs color extraction from an image using KMeans clustering. Given an input image, the model identifies the dominant colors present in the image and returns their HEX codes, along with the color closest to white. |
|
|
|
|
|
Model Details: |
|
|
- Model Type: Color Extraction |
|
|
- Model Name: ColorExtractionPipeline |
|
|
- Architecture: KMeans Clustering |
|
|
- Compatible Transformers Library Version: >=4.11.0 |
|
|
|
|
|
Input Format: |
|
|
- The model takes an image in the form of a PIL (Python Imaging Library) image. |
|
|
|
|
|
Output Format: |
|
|
- A list of HEX codes representing the dominant colors in the image. |
|
|
- The HEX code of the color closest to white in the image. |
|
|
|
|
|
Usage: |
|
|
```python |
|
|
from transformers import pipeline |
|
|
from PIL import Image |
|
|
|
|
|
# Load the color extraction pipeline |
|
|
color_extraction = pipeline("color-extraction") |
|
|
|
|
|
# Load an image using PIL (Python Imaging Library) |
|
|
image = Image.open("path/to/your/image.jpg") |
|
|
|
|
|
# Perform color extraction on the image |
|
|
colors, closest_to_white = color_extraction(image) |
|
|
|
|
|
# Print the results |
|
|
print("Dominant Colors:", colors) |
|
|
print("Color Closest to White:", closest_to_white) |
|
|
|