test_utils.py 文件源码

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

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


问题


面经


文章

微信
公众号

扫码关注公众号