%matplotlib inline
The pyramid_laplacian function takes an image and yields successive images shrunk by a constant scale factor. Image pyramids are often used, e.g., to implement algorithms for denoising, texture discrimination, and scale- invariant detection.
import numpy as np
import matplotlib.pyplot as plt
from skimage import data
from skimage import io
from skimage.transform import pyramid_laplacian
You can read more about Lybua in the Scientific Amercian.
image = io.imread("../images/Lyuba-CT_350.tif")
rows, cols = image.shape
pyramid = tuple(pyramid_laplacian(image, downscale=2))
Construct a composite image of the downsampled Gaussian filtered images.
composite_image = np.zeros((rows, cols + cols // 2), dtype=np.double)
composite_image[:rows, :cols] = pyramid[0]
i_row = 0
for p in pyramid[1:]:
n_rows, n_cols = p.shape[:2]
composite_image[i_row:i_row + n_rows, cols:cols + n_cols] = p
i_row += n_rows
fig, ax = plt.subplots(figsize=(30, 15))
ax.imshow(composite_image, cmap='gray')
plt.axis('equal')
plt.show()