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
drawModule.py 文件源码
python
阅读 32
收藏 0
点赞 0
评论 0
评论列表
文章目录