def test_get_palette_max_values(self):
image = utils.Image.get_images([self.image_clean])[0].image
rgb_image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
options = namedtuple(
'options',
['quiet', 'sample_fraction', 'value_threshold', 'sat_threshold']
)(
quiet=True,
sample_fraction=1,
value_threshold=1,
sat_threshold=1,
)
samples = noteshrink.sample_pixels(rgb_image, options)
palette = utils.get_palette(samples, 128, background_value=100,
background_saturation=100)
background_color = np.array([255, 123, 92])
assert palette.shape <= (128, 3)
# background colors must coincide
assert np.array_equal(palette[0], background_color)
评论列表
文章目录