MCPcopy Create free account
hub / github.com/FireRedTeam/LayerDiffuse-Flux / build_alpha_pyramid

Function build_alpha_pyramid

lib_layerdiffuse/vae.py:191–208  ·  view source on GitHub ↗
(color, alpha, dk=1.2)

Source from the content-addressed store, hash-verified

189
190
191def build_alpha_pyramid(color, alpha, dk=1.2):
192 # Written by lvmin at Stanford
193 # Massive iterative Gaussian filters are mathematically consistent to pyramid.
194
195 pyramid = []
196 current_premultiplied_color = color * alpha
197 current_alpha = alpha
198
199 while True:
200 pyramid.append((current_premultiplied_color, current_alpha))
201
202 H, W, C = current_alpha.shape
203 if min(H, W) == 1:
204 break
205
206 current_premultiplied_color = cv2.resize(current_premultiplied_color, (int(W / dk), int(H / dk)), interpolation=cv2.INTER_AREA)
207 current_alpha = cv2.resize(current_alpha, (int(W / dk), int(H / dk)), interpolation=cv2.INTER_AREA)[:, :, None]
208 return pyramid[::-1]
209
210
211def pad_rgb(np_rgba_hwc_uint8):

Callers 1

pad_rgbFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected