$24.99
Objective
The objective of this lab is to familiarize yourself with basic image processing and transformation operations. The lab has three parts:
1. Histogram Normalization & Equalization
2. Gaussian & Laplacian Image Pyramids
3. Image Blending
You are free to use any functions in numpy to help you, but other built-in functions for image processing are not allowed. If you are new to Python and Jupyter Notebooks, please review the materials in the Python Refresher in LumiNUS¿Files¿Labs to help you start your work.
Part 1: Histogram Equalization and Normalization (35%)
In this part, you are asked to implement the following 5 functions: cs4243 resize(), cs4243 rgb2grey(), cs4243 histnorm(), cs4243 histequ() and cs4243 histmatch(). The expected outcomes of each function are shown in in Fig. 1 and main.ipynb. The code skeletons for the functions are given in transform.py.
For simplicity, we consider only greyscale images in this lab. Given a colour image, first resize it to a smaller image and then convert it from RGB to greyscale. Afterwards, perform histogram normalization, equalization or matching to enhance the image contrast. Image normalization (equalization) is to stretch the range of image intensity linearly (uniformly). Histogram matching is to make the image histogram match with the histogram of the reference image, which means that you have to find a mapping of intensity between two images according to their cumulative histograms.
Figure 1: Image histogram normalization, equalization and matching.
Figure 2: Gaussian & Laplacian Pyramid.
Part 2 Gaussian and Laplacian Pyramid (55%)
Part 3 Image Blending (10%)
One neat use for Laplacian image pyramids is to blend two images together (see Fig. 3). For image blending, you separately build the Laplacian pyramids for the two constituent images and linearly combine them different pyramid levels during reconstruction.
Figure 3: Apple and orange blending example.
The general approach for image blending is as follows:
1. Construct Laplacian pyramids LA and LB from composing images A and B.
2. Build a Gaussian pyramid GR on a mask R which selects the pixels coming from A vs B
3. Construct a combined pyramid Lc from La and Lb by using the elements of GR as weights, where Lc(i, j) = GR(i, j) ∗ LA(i, j) + (1 − GR(i, j)) ∗ LB(i, j)
4. Reconstruct belended image from Lc.
An example of linearly combining two images with a mask is given in main.ipynb.
Useful Resources and Extension Reading
Nearest-Neighbour Image Resizing [link]
Histogram Equalization[link]
Histogram Normalization[link]
Histogram Matching[link]
Image Filtering[link]
Blending[link]
Hand in