To begin, the cameraman image is convolved with both finite difference operators D_x and D_y.
The gradient magnitude is calculated by taking the magnitude, or norm, of these gradient components:
grad_mag = np.sqrt(dx**2 + dy**2)
. This gradient magnitude image is binarized with a selected
threshold, where values above the threshold qualify and are displayed as edges.
Seeing that the edges detected above are rather noisy, the cameraman image can be blurred before performing the process, as shown below. The differences that we see include the edges being thicker and smoother, as well as less noise on the man, camera, and background.
Blurring and computing the gradient magnitude can also be completed in a single convolution: by convolving the blurring/gaussian filter with D_x and D_y, the resulting DoG filters can be directly applied to the original cameraman image.
Images can be "sharpened" using the unsharp masking technique. This can be done in two ways:
alpha
times of the remaining high
frequencies back to the originalBelow are results for different values of alpha, showing the progression of the original to sharpened images.
The following progression tries first blurring, then sharpening an image. The sharpened image clearly loses a lot of the original's detail, is noisy, and contains artifacts.
Hybrid images (are static images! that) change with the viewer's distance to the image. From the blending of high frequencies of one image with low frequencies of another, the viewer sees the first image when they are up close, and the second when they are far.
Before multi-resolution blending, Gaussian and Laplacian stacks are created. Gaussian stacks involve
repeatedly applying the Gaussian filter at each level of the stack, and Laplacian stacks involve subtracting
a level of the Gaussian stack from the previous level. However, the final level of the Laplacian matches the
final level of the Gaussian so that the original image can be reconstructed by collapsing the Laplacian
stack.
Stacks of an apple:
Stacks of an orange:
To perform multi-resolution blending, each level of the Laplacian stacks across two images are blended together. This blending works best with similar Gaussian blurring of a mask. The combined layers are finally compressed into the blended image.