def visualize_spans(name, small, pagemask, spans):
regions = np.zeros_like(small)
for i, span in enumerate(spans):
contours = [cinfo.contour for cinfo in span]
cv2.drawContours(regions, contours, -1,
CCOLORS[i*3 % len(CCOLORS)], -1)
mask = (regions.max(axis=2) != 0)
display = small.copy()
display[mask] = (display[mask]/2) + (regions[mask]/2)
display[pagemask == 0] /= 4
debug_show(name, 2, 'spans', display)
评论列表
文章目录