def laplacian_pyramid_blending(imageA, imageB, mask): levels = 6 # Construct Laplacian pyramids for images A and B la = tuple(pyramid_laplacian(imageA, downscale=levels, preserve_range=True, channel_axis=2)) lb = tuple(pyramid_laplacian(imageB, downscale=levels, preserve_range=True, channel_axis=2))
# Construct a Gaussian pyramid for the mask
gm = tuple(pyramid_gaussian(mask, downscale=levels, preserve_range=True, channel_axis=2))
# Create the blended Laplacian pyramid Lc
lc = []
for k in range(levels-1):
lc.append(gm[k]*la[k]+(1-gm[k])*lb[k])
# Sum all levels in Lc to get the blended image
blended_image = lc[0]
for i in lc[1:]:
i = resize(i, blended_image.shape)
blended_image += i
return blended_image
i was a expecting a full rgb image