def _get_lineSeg_Disp_all(self):
# draw mask on img_arr with foreground painted in its "color_fill" (only display cur_line_type2 lineSeg)
## always draw on original_sized arr
img_arr = self.ori_img.copy()
# self.final_BI = np.zeros(img_arr.shape, np.uint8) if self.final_BI is None else self.final_BI
bi_t = np.zeros(self.final_BI.shape, np.uint8)
# print "img_arr.shape = {}".format(img_arr.shape)
# display all types in one img
for lineType in self.line_types.keys():
if "label" not in self.line_types[lineType].keys():
continue
# print ">>>>>>>>>>>>> ", lineType
label = self.line_types[lineType]["label"]
color_fill = self.line_types[lineType]["color_fill"][0]
bi_t[:] = 0
bi_t[self.final_BI == label] = 255
### 1) visualize line type
if np.count_nonzero(bi_t) > 0:
# Image.fromarray(bi_t).show()
bi_t_img = Image.fromarray(bi_t)
img = Image.fromarray(img_arr)
draw = ImageDraw.Draw(img, mode='RGB')
draw.bitmap((0, 0), bi_t_img, fill=tuple(color_fill))
img_arr = np.array(img)
lineSeg_Disp = img_arr
# Image.fromarray(lineSeg_Disp).show()
return lineSeg_Disp
评论列表
文章目录