Spaces:
Running
Running
fix: testing quantized with 16 colors and tolerance with 15
Browse files- recolorStrictTransfer.py +2 -2
recolorStrictTransfer.py
CHANGED
@@ -17,7 +17,7 @@ def color_transfer(image, old_colors_hex, new_colors_hex):
|
|
17 |
|
18 |
# Convert image to LAB color space for more accurate color comparison
|
19 |
image_array = np.asarray(image)
|
20 |
-
image_quantized = quantize_global(image_array,
|
21 |
image_np = np.array(image_quantized)
|
22 |
image_lab = rgb2lab(image_np)
|
23 |
# image_lab = cv2.cvtColor(image, cv2.COLOR_RGB2LAB)
|
@@ -30,7 +30,7 @@ def color_transfer(image, old_colors_hex, new_colors_hex):
|
|
30 |
recolored_image = image.copy()
|
31 |
|
32 |
# Define a tolerance for color matching
|
33 |
-
tolerance =
|
34 |
|
35 |
# For each old color, find the pixels that match and replace them with the new color
|
36 |
for old_color_lab, new_color_rgb in zip(old_colors_lab, new_colors_rgb):
|
|
|
17 |
|
18 |
# Convert image to LAB color space for more accurate color comparison
|
19 |
image_array = np.asarray(image)
|
20 |
+
image_quantized = quantize_global(image_array, 16)
|
21 |
image_np = np.array(image_quantized)
|
22 |
image_lab = rgb2lab(image_np)
|
23 |
# image_lab = cv2.cvtColor(image, cv2.COLOR_RGB2LAB)
|
|
|
30 |
recolored_image = image.copy()
|
31 |
|
32 |
# Define a tolerance for color matching
|
33 |
+
tolerance = 15.0 # Delta E value
|
34 |
|
35 |
# For each old color, find the pixels that match and replace them with the new color
|
36 |
for old_color_lab, new_color_rgb in zip(old_colors_lab, new_colors_rgb):
|