by Shenghan Zhou
The gradient magnitude computation involves determining the strength of changes in intensity at each point in an image. Filters like \( D_x = \begin{bmatrix} -1 & 1 \end{bmatrix} \) and \( D_y = \begin{bmatrix} -1 \\ 1 \end{bmatrix} \) are finite difference operators to estimate the gradient in the horizontal and vertical directions, respectively.
This is a horizontal gradient filter that computes the difference between adjacent pixels in the x-direction (left to right). It measures the change in intensity between a pixel and its neighbor.
This is a vertical gradient filter that computes the difference between adjacent pixels in the y-direction (top to bottom). It measures the change in intensity between a pixel and the pixel below it.
Once you apply these filters to the image, you get two gradients at each pixel location: one in the x-direction (\( G_x \)) and one in the y-direction (\( G_y \)). The magnitude of the gradient at each point can be computed using:
\[ |\nabla I| = \sqrt{G_x^2 + G_y^2} \]
\[ G_{x} \] |
\[ G_{y} \] |
gradient magnitude |
binary magnitude |
The threshold for the binary magnitude is set to 80. If a pixel’s value exceeds 20, it is considered part of an edge.
\[ G_{x} \] |
\[ G_{y} \] |
gradient magnitude |
binary magnitude |
Convolving the gaussian with \[D_x\] |
Convolving the gaussian with \[D_y\] |
\[ G_{x} \] |
\[ G_{y} \] |
gradient magnitude |
binary magnitude |
\[\alpha=0\] |
\[\alpha=1\] |
\[\alpha=2\] |
\[\alpha=3\] |
\[\alpha=4\] |
Original image |
\[\alpha=1\] |
\[\alpha=2\] |
\[\alpha=3\] |
\[\alpha=4\] |
Original image |
Blurring image |
\[\alpha=1\] |
\[\alpha=2\] |
\[\alpha=3\] |
\[\alpha=4\] |
In the above visualization, we first compute the low frequency of DerekPicture nad the high frequency of nutmeg. Then, we add them together. The small size hybrid image simulates from viewing the image from a distance. In this case, we can see DerekPicture from the hybrid image
From the visualization, we can see that the low-pass filter removes the high frequencies, while the high-pass filter eliminates the low frequencies. The frequency of the hybrid image is a combination of the low frequencies from one image and the high frequencies from another.
original image |
original image |
hybrid image |
In this example, it clearly illustrates that when we are close to the image, the high frequencies dominate our perception. However, when the hybrid image is viewed from a distance, we can perceive the low frequencies.
original image |
original image |
hybrid image |
Because the dog’s body is also a high frequency, even with perfect alignment, we cannot keep only the dog’s head and the man’s body in the suit.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Big dog
|
Man in suit
|
Mask
|
|
|
|
|
|
|
Cute cat
|
Owl
|
Mask
|
|
|
|
|
|
|