In this part, the humble finite difference is used as our filter in the $x$ and $y$ directions. $$ D_{x} = \begin{bmatrix} 1 & -1 \\ \end{bmatrix} ~~~~~~~~ D_{y} = \begin{bmatrix} 1 \\ -1 \\ \end{bmatrix} $$ The partial derivative in x and y of the cameraman image is shown below:
Original Image
Convolved with Dx
Convolved with Dy
To compute the gradient magnitude image, consider the formula mentioned in the course: $$ \|\nabla f\| = \sqrt{\left(\frac{\partial f}{\partial x}\right)^{2} + \left(\frac{\partial f}{\partial y}\right)^{2}}. $$ To binarize the gradient magnitude image, I choose the threshold $\epsilon = 0.26$. All pixels with values greater than the threshold are set to 1, while others are set to 0.
The results are shown below:
Gradient Magnitude Image
Edge Image
Here are the related parameters in this part: $$ \textbf{Gaussian filter: } \sigma = 1 \text{ with } 9 \times 9 \text{ kernel} $$ $$ \textbf{Threshold } \text{for edge binarization: 0.065} $$
Gaussian Blurred Image
Convolved with Dx
Convolved with Dy
Gradient Magnitude
Edge Image
Compared with the edge image in Part 1.1, all the edges and lines are bolder now which helps us to identify the edge much clearer.
Gaussian convolved with Dx (Filter 1)
Gaussian convolved with Dy (Filter 2)
Convolved with DoG filter 1
Convolved with DoG filter 2
Gradient Magnitude Image
Edge Image
In addition, we could verify that the edge images generated by mthod 1 and method 2 are the same.
By subtracting the blurred version from the original image, we can isolate the high-frequency details. An image often looks sharper if it has stronger high frequencies. To enhance this effect, we can increase the high-frequency content. This process can be combined into a single convolution operation known as the unsharp mask filter. In other words, we have $$ \text{Image - Blurred = High Frequency (Details)} $$ $$ \text{Image + } \alpha \cdot \text{High Frequency = Sharpened} $$
Here are the results on the given image and the image of my choice:
Original Image
Gaussian Blurred Image
High Frequency
Sharpened Image
Original Image
Gaussian Blurred Image
High Frequency
Sharpened Image
For evaluation, I also pick a sharp image ferriswheel.jpg
, blur it and then sharpen it again.
$$
\sigma = 2 \text{ with } 9 \times 9 \text{ kernel, } \alpha = 5
$$
Original Image
Gaussian Blurred Image
Sharpened Image
The sharpened image is not the same as the original one but I don't think this improves the accuracy or the quality.
Here you could see some examples of hybrid images that I realized using the described method.
''DerekPicture.jpg''
''nutmeg.jpg''
Hybrid Image
''Monroe.png''
''Einstein.png''
Hybrid Image
''wolf.jpg''
''panda.jpg''
Hybrid Image
Here are the Gaussian stacks and Laplacian stacks of ''apple.jpeg'' and ''orange.jpeg''. I use the gaussian filter of $\sigma = 5$ with $25 \times 25$ kernel.
Denote the two target images as $A$ and $B$. To blend them together, I need to figure out the approximate mask. Then, I create the Laplacian stacks for both of them and then create the Gaussian stack for their mask. Follow the formula below: $$ l_{k} = m_{k} \cdot l_{k}^{A} + (1 - m_{k}) \cdot l_{k}^{B} $$ We could build the stack of the blend of image and then generate the image from it.
Here are some examples:
The oraple is constructed using a horizontal regular mask. The parameters of the stacks are as below:
The oraple is constructed using a vertical regular mask. The parameters of the stacks are as below:
The oraple is constructed using a vertical regular mask. The parameters of the stacks are as below:
Actually, my favourate result is the oraple, so I will illustrate the process for you. The full Laplacian stack is as below: