image_processing.py
ImageProcessing
A collection of image processing methods for loading, transforming, and segmenting colors within an image using Pillow instead of OpenCV.
Source code in pycht/image_processing.py
7 8 9 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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
color_separation(clustered_pixels, input_path, output_dir, background_color=(0, 0, 0))
Generate and save separate stencil images for each color cluster in the input image.
Source code in pycht/image_processing.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|
process(input_path)
Load an image from disk and flatten it into a 2D array of float32 pixels.
Source code in pycht/image_processing.py
13 14 15 16 17 18 19 20 |
|
to_bgra_with_alpha(image, alpha_mask)
staticmethod
Convert an RGB image to RGBA using a binary alpha mask.
Source code in pycht/image_processing.py
29 30 31 32 33 34 35 36 37 38 |
|
write_image(image, output_path)
staticmethod
Write image to a file.
Source code in pycht/image_processing.py
22 23 24 25 26 27 |
|