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

Function find_anchors

inpaint/utils.py:1393–1401  ·  view source on GitHub ↗
(matrix)

Source from the content-addressed store, hash-verified

1391 return reduce(mul, size)
1392
1393def find_anchors(matrix):
1394 matrix = [[*x] for x in matrix]
1395 mh, mw = max_size(matrix)
1396 matrix = np.array(matrix)
1397 # element = np.zeros((mh, mw))
1398 for i in range(matrix.shape[0] + 1 - mh):
1399 for j in range(matrix.shape[1] + 1 - mw):
1400 if matrix[i:i + mh, j:j + mw].max() == 0:
1401 return i, i + mh, j, j + mw
1402
1403def find_largest_rect(dst_img, bg_color=(128, 128, 128)):
1404 valid = np.any(dst_img[..., :3] != bg_color, axis=-1)

Callers 1

find_largest_rectFunction · 0.85

Calls 1

max_sizeFunction · 0.85

Tested by

no test coverage detected