def viz_textbb(fignum,text_im, bb_list,alpha=1.0):
"""
text_im : image containing text
bb_list : list of 2x4xn_i boundinb-box matrices
"""
plt.close(fignum)
plt.figure(fignum)
plt.imshow(text_im)
plt.hold(True)
H,W = text_im.shape[:2]
for i in xrange(len(bb_list)):
bbs = bb_list[i]
ni = bbs.shape[-1]
for j in xrange(ni):
bb = bbs[:,:,j]
bb = np.c_[bb,bb[:,0]]
plt.plot(bb[0,:], bb[1,:], 'r', linewidth=2, alpha=alpha)
plt.gca().set_xlim([0,W-1])
plt.gca().set_ylim([H-1,0])
plt.show(block=False)
评论列表
文章目录