-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Description
you should fix the "create_laplacian_image_pyramid" in the pyramid.py .
it should be like this
def create_laplacian_image_pyramid(image, pyramid_levels):
gauss_pyramid = []
laplacian_pyramid = []
gauss_pyramid.append(image) # Start with the original image
for i in range(pyramid_levels):
down_image = cv2.pyrDown(gauss_pyramid[i])
gauss_pyramid.append(down_image)
for i in range(pyramid_levels):
# Convert to 3 channels before subtraction (KEY CHANGE)
current_level = gauss_pyramid[i]
if current_level.ndim == 3 and current_level.shape[2] == 4: #Check if it has 4 channels
current_level = current_level[:,:,:3] #Slice to 3 channels
if i < pyramid_levels - 1: #Only upsample if it's not the last level
higher_level_upsampled = cv2.pyrUp(gauss_pyramid[i + 1])
if higher_level_upsampled.ndim == 3 and higher_level_upsampled.shape[2] == 4: #Check if it has 4 channels
higher_level_upsampled = higher_level_upsampled[:,:,:3] #Slice to 3 channels
laplacian_pyramid.append((current_level - higher_level_upsampled) + 0) # Add 0 for type consistency.
else:
laplacian_pyramid.append(current_level) # The last level is just the last Gaussian level.
return laplacian_pyramid
Metadata
Metadata
Assignees
Labels
No labels