test_utils.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:histonets-cv 作者: sul-cidr 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号