import_labelme.py 文件源码

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

项目:facade-segmentation 作者: jfemiani 项目源码 文件源码
def __init__(self, annotation, nrows=512, ncols=None):
        super(SingleLayerLabels, self).__init__()
        self.annotation = annotation

        assert annotation.imagesize.nrows is not None, "Must know the image size first (see update_image_size)"

        self.aspect = annotation.imagesize.ncols/float(annotation.imagesize.nrows)
        self.y_scale = nrows / float(annotation.imagesize.nrows)
        self.nrows = nrows
        if ncols is None:
            self.x_scale = self.y_scale
            self.ncols = int(self.x_scale*annotation.imagesize.ncols)
        else:
            self.x_scale = ncols / float(annotation.imagesize.ncols)
            self.ncols = ncols

        self.image = Image.new('L', (self.ncols, self.nrows), LABEL_NEGATIVE)
        self.artist = ImageDraw.Draw(self.image)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号