def draw_graph(img, graph, cn=255, ce=128):
acc = np.cumprod((1,)+img.shape[::-1][:-1])[::-1]
img = img.ravel()
for idx in graph.nodes():
pts = graph.node[idx]['pts']
img[np.dot(pts, acc)] = cn
for (s, e) in graph.edges():
eds = graph[s][e]
for i in eds:
pts = eds[i]['pts']
img[np.dot(pts, acc)] = ce
评论列表
文章目录