MCPcopy Index your code
hub / github.com/thygate/stable-diffusion-webui-depthmap-script / applyGridpatch

Function applyGridpatch

src/depthmap_generation.py:1102–1115  ·  view source on GitHub ↗
(blsize, stride, img, box)

Source from the content-addressed store, hash-verified

1100
1101
1102def applyGridpatch(blsize, stride, img, box):
1103 # Extract a simple grid patch.
1104 counter1 = 0
1105 patch_bound_list = {}
1106 for k in range(blsize, img.shape[1] - blsize, stride):
1107 for j in range(blsize, img.shape[0] - blsize, stride):
1108 patch_bound_list[str(counter1)] = {}
1109 patchbounds = [j - blsize, k - blsize, j - blsize + 2 * blsize, k - blsize + 2 * blsize]
1110 patch_bound = [box[0] + patchbounds[1], box[1] + patchbounds[0], patchbounds[3] - patchbounds[1],
1111 patchbounds[2] - patchbounds[0]]
1112 patch_bound_list[str(counter1)]['rect'] = patch_bound
1113 patch_bound_list[str(counter1)]['size'] = patch_bound[2]
1114 counter1 = counter1 + 1
1115 return patch_bound_list
1116
1117
1118# Adaptively select patches

Callers 1

generatepatchsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected