drawModule.py 文件源码

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

项目:PSPNet-Keras-tensorflow 作者: Vladkryvoruchko 项目源码 文件源码
def drawSimpleSegment(self):

        #Drawing module
        im_Width, im_Height = self.pred_size
        prediction_image = Image.new("RGB", (im_Width, im_Height) ,(0,0,0))
        prediction_imageDraw = ImageDraw.Draw(prediction_image)

        #BASE all image segmentation
        for i in range(im_Width):
            for j in range(im_Height):
                #get matrix element class(0-149)
                px_Class = self.predicted_classes[j][i]
                #assign color from .mat list
                put_Px_Color = tuple(self.class_colors['colors'][px_Class])

                #drawing
                prediction_imageDraw.point((i,j), fill=put_Px_Color)

        #Resize to original size and save
        self.coef, self.h_pad, self.w_pad = self.calculateResize()
        FullHdOutImage = self.resizeToOutput(prediction_image, self.coef, self.h_pad, self.w_pad)
        FullHdOutImage = Image.blend(FullHdOutImage, self.im, 0.5)

        return FullHdOutImage
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号