计算机视觉代写 | EECS 442: Foundations of Computer Vision Problem Set 2: Signal Processing
The starter code can be found at:
We recommend editing and running your code in Google Colab, although you are welcome to
use your local machine instead.
Image pyramids are image representations useful for many downstream applications. This
problem uses pyramid image processing to blend two images.
Figure 1: Blending with a Laplacian pyramid of 6 levels. Note that your result may look
different than ours.
(a) (4 points) First we will implement the following functions:
• pyramid upsample
• pyramid downsample
• gen gaussian pyramid
• gen laplacian pyramid
• reconstruct img
Given an original image, we will build a Laplacian pyramid to reconstruct it. Please use Gaus-
sian kernels with the same size for pyramid upsample and pyramid downsample. The only dif-
ference is that the kernel for pyramid upsample will be the one used for pyramid downsample
multiplied by 4. You can set the standard deviation of the Gaussian kernel as = 1. Please
plot the original image, the Laplacian pyramid, and the reconstructed image. Please use a
Laplacian pyramid with 4 levels. (Hint: np.insert may come in handy when implementing
(b) (2 points) Implement the function pyramid blend(im1, im2, mask, num levels). Its
inputs are two images and a binary mask (indicating which pixels to use from each image).
The function produces a Laplacian pyramid with num levels levels that will blend the two
image inputs. Use your function to blend the images of an orange and an apple that we
provided in the Colab notebook. Plot the blended images with num levels 2 f1; 2; 3; 4; 5; 6g.
Please describe the difference between the blended images as the number of levels in the
Laplacian pyramid varies: how does the result change as we increase the number of levels?
To obtain color images, you can apply the blending to each color channel independently. In
our implementation, this did not require any extra code (the same code worked on single-
channel and multi-channel images due to numpy broadcasting), but your implementation may
(c) (Optional, 0 points) Use your code to blend your own images. If you would not like
your blending results shown in class, please let us know!