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

Function open_small_mask

inpaint/utils.py:54–64  ·  view source on GitHub ↗
(mask, context, open_iteration, kernel)

Source from the content-addressed store, hash-verified

52 return xs, ys, zs
53
54def open_small_mask(mask, context, open_iteration, kernel):
55 np_mask = mask.cpu().data.numpy().squeeze().astype(np.uint8)
56 raw_mask = np_mask.copy()
57 np_context = context.cpu().data.numpy().squeeze().astype(np.uint8)
58 np_input = np_mask + np_context
59 for _ in range(open_iteration):
60 np_input = cv2.erode(cv2.dilate(np_input, np.ones((kernel, kernel)), iterations=1), np.ones((kernel,kernel)), iterations=1)
61 np_mask[(np_input - np_context) > 0] = 1
62 out_mask = torch.FloatTensor(np_mask).to(mask)[None, None, ...]
63
64 return out_mask
65
66def filter_irrelevant_edge_new(self_edge, comp_edge, other_edges, other_edges_with_id, current_edge_id, context, depth, mesh, context_cc, spdb=False):
67 other_edges = other_edges.squeeze().astype(np.uint8)

Callers 2

depth_inpaintingFunction · 0.90
DL_inpaint_edgeFunction · 0.90

Calls 1

toMethod · 0.80

Tested by

no test coverage detected