pycht.py
Main project logic for generating color-separated stencils from an input image.
Pycht
Main interface for generating color-separated stencils from an input image.
This class orchestrates the image processing and clustering steps by
using the ImageProcessing and Clustering components.
Source code in pycht/pycht.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
stencil(input_img, nb_colors=3, output_path='./')
Generate color stencils from an input image using K-Means clustering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_img
|
Path or str
|
Path to the input image file. |
required |
output_path
|
Path or str
|
Directory path to save the stencil images. |
'./'
|
nb_colors
|
int
|
Number of color clusters to segment the image into. |
3
|
Examples:
Basic usage:
>>> import pycht
>>> pycht.stencil('cat.jpg', 5)
Source code in pycht/pycht.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |