def load_dotted_image(self, train_id, scale=1, border=0, circled=False):
img = self._load_image('dotted', train_id, scale, border)
if train_id in self.extra_masks:
for row, col, radius in self.extra_masks[train_id]:
rr, cc = skimage.draw.circle(row, col, radius, shape = img.shape)
img = np.copy(img)
img[rr, cc] = (0, 0, 0)
# When dotted image is rotated relative to train, apply hot patch. (kudos: @authman)
if train_id in self.dotted_rotate:
rot = self.dotted_rotate[train_id]
img = np.rot90(img, rot)
if circled:
assert scale == 1
assert border == 0
img = np.copy(img)
img = self.draw_circles(np.copy(img), self.tid_coords[train_id])
return img
评论列表
文章目录