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

Function judge_dangle

inpaint/mesh.py:721–737  ·  view source on GitHub ↗
(mark, mesh, node)

Source from the content-addressed store, hash-verified

719 return mesh
720
721def judge_dangle(mark, mesh, node):
722 if not (1 <= node[0] < mesh.graph['H']-1) or not(1 <= node[1] < mesh.graph['W']-1):
723 return mark
724 mesh_neighbors = [*mesh.neighbors(node)]
725 mesh_neighbors = [xx for xx in mesh_neighbors if 0 < xx[0] < mesh.graph['H'] - 1 and 0 < xx[1] < mesh.graph['W'] - 1]
726 if len(mesh_neighbors) >= 3:
727 return mark
728 elif len(mesh_neighbors) <= 1:
729 mark[node[0], node[1]] = (len(mesh_neighbors) + 1)
730 else:
731 dan_ne_node_a = mesh_neighbors[0]
732 dan_ne_node_b = mesh_neighbors[1]
733 if abs(dan_ne_node_a[0] - dan_ne_node_b[0]) > 1 or \
734 abs(dan_ne_node_a[1] - dan_ne_node_b[1]) > 1:
735 mark[node[0], node[1]] = 3
736
737 return mark
738
739def remove_dangling(mesh, edge_ccs, edge_mesh, info_on_pix, image, depth, config):
740

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected