MCPcopy
hub / github.com/lllyasviel/sd-forge-layerdiffuse / build_alpha_pyramid

Function build_alpha_pyramid

lib_layerdiffusion/models.py:188–202  ·  view source on GitHub ↗
(color, alpha, dk=1.2)

Source from the content-addressed store, hash-verified

186
187
188def build_alpha_pyramid(color, alpha, dk=1.2):
189 pyramid = []
190 current_premultiplied_color = color * alpha
191 current_alpha = alpha
192
193 while True:
194 pyramid.append((current_premultiplied_color, current_alpha))
195
196 H, W, C = current_alpha.shape
197 if min(H, W) == 1:
198 break
199
200 current_premultiplied_color = cv2.resize(current_premultiplied_color, (int(W / dk), int(H / dk)), interpolation=cv2.INTER_AREA)
201 current_alpha = cv2.resize(current_alpha, (int(W / dk), int(H / dk)), interpolation=cv2.INTER_AREA)[:, :, None]
202 return pyramid[::-1]
203
204
205def pad_rgb(np_rgba_hwc_uint8):

Callers 1

pad_rgbFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected