utils.py 文件源码

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

项目:histonets-cv 作者: sul-cidr 项目源码 文件源码
def __init__(self, content=None, image=None):
        self.image = None
        self.format = None
        if isinstance(image, Image):
            self.image = image.image
            self.format = image.format
        elif image is not None:
            self.image = image
        elif content:
            image_format = imghdr.what(file='', h=content)
            if image_format is not None:
                image_array = np.fromstring(content, np.uint8)
                self.image = cv2.imdecode(image_array, cv2.IMREAD_COLOR)
                self.format = image_format
        if self.image is None:
            raise click.BadParameter('Image format not supported')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号