def test_get_palette_min_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=.01,
value_threshold=.01,
sat_threshold=.01,
)
samples = noteshrink.sample_pixels(rgb_image, options)
palette = utils.get_palette(samples, 2, background_value=1,
background_saturation=1)
test_palette = np.array([[255, 123, 92], [193, 86, 64]])
assert palette.shape <= test_palette.shape
# background colors must coincide
assert np.array_equal(palette[0], test_palette[0])
评论列表
文章目录