Begin assembling preview image

This commit is contained in:
Matt McWilliams 2023-10-24 21:01:09 -04:00
parent 654726840d
commit dd1e559581
1 changed files with 10 additions and 5 deletions

View File

@ -64,7 +64,7 @@ class Posterize:
white = closest_color(self.original_colors, [255, 255, 255])
blank = create_colored_image(self.w, self.h, [255, 255, 255])
composite = create_colored_image(self.w, self.h, [255, 255, 255])
for i in range(self.n_colors) :
if list_match(self.original_colors[i], white) :
continue
@ -72,11 +72,16 @@ class Posterize:
closest = closest_color(self.colors, self.original_colors[i])
self.colors = remove_from_list(self.colors, closest)
name = self.match_color_name(closest)
cv2.imwrite(f'{name}.png', mask)
color_mat = create_colored_image(self.w, self.h, closest)
blank = cv2.bitwise_and(color_mat, color_mat, mask = (255-mask))
cv2.imshow('image', blank)
cv2.imwrite(f'{name}.png', mask)
color_mat = create_colored_image(self.w, self.h, closest)
color_mask = cv2.bitwise_or(color_mat, color_mat, mask = (255-mask))
cv2.imshow('image', composite)
cv2.waitKey(0)
cv2.destroyAllWindows()