MCPcopy Create free account
hub / github.com/thygate/stable-diffusion-webui-depthmap-script / incomplete_node

Function incomplete_node

inpaint/mesh_tools.py:684–710  ·  view source on GitHub ↗
(mesh, edge_maps, info_on_pix)

Source from the content-addressed store, hash-verified

682 return osize_dict
683
684def incomplete_node(mesh, edge_maps, info_on_pix):
685 vis_map = np.zeros((mesh.graph['H'], mesh.graph['W']))
686
687 for node in mesh.nodes:
688 if mesh.nodes[node].get('synthesis') is not True:
689 connect_all_flag = False
690 nes = [xx for xx in mesh.neighbors(node) if mesh.nodes[xx].get('synthesis') is not True]
691 if len(nes) < 3 and 0 < node[0] < mesh.graph['H'] - 1 and 0 < node[1] < mesh.graph['W'] - 1:
692 if len(nes) <= 1:
693 connect_all_flag = True
694 else:
695 dan_ne_node_a = nes[0]
696 dan_ne_node_b = nes[1]
697 if abs(dan_ne_node_a[0] - dan_ne_node_b[0]) > 1 or \
698 abs(dan_ne_node_a[1] - dan_ne_node_b[1]) > 1:
699 connect_all_flag = True
700 if connect_all_flag == True:
701 vis_map[node[0], node[1]] = len(nes)
702 four_nes = [(node[0] - 1, node[1]), (node[0] + 1, node[1]), (node[0], node[1] - 1), (node[0], node[1] + 1)]
703 for ne in four_nes:
704 for info in info_on_pix[(ne[0], ne[1])]:
705 ne_node = (ne[0], ne[1], info['depth'])
706 if info.get('synthesis') is not True and mesh.has_node(ne_node):
707 mesh.add_edge(node, ne_node)
708 break
709
710 return mesh
711
712def edge_inpainting(edge_id, context_cc, erode_context_cc, mask_cc, edge_cc, extend_edge_cc,
713 mesh, edge_map, edge_maps_with_id, config, union_size, depth_edge_model, inpaint_iter):

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected