Using the finite difference operators, convolve the image with each derivative filter to obtain the partial derivatives with respect to x and y. Then, the gradient is simply the vector whose first component is the partial derivative along x and second component is the partial derivative along y. Of couse, we cannot plot this as an image, so we take its magnitude (Euclidean norm) and make an image. The magnitude gradient image has the edges of the original image.
Derivative wrt to x-axis | Binarized partial derivative |
---|---|
Derivative wrt to y-axis | Binarized partial derivative |
Gradient | Binarized Gradient |
Blur the image with a low-pass filter, a Gaussian kernel, and then compute the derivatives of the image. The results below are clearly much better than those above due to the low-pass filter removing noise in the images which the filters above picked up as "edges". By smoothing, we ignore these fake edges but still preserve the original edges.
Derivative wrt to x-axis | Binarized partial derivative |
---|---|
Derivative wrt to y-axis | Binarized partial derivative |
Gradient | Binarized Gradient |
Make a single filter, by taking the derivative of the Gaussian kernel which is the convolution of the kernel with each difference operator, and then convolve with the image.
Derivative wrt to x-axis | Binarized partial derivative |
---|---|
Derivative wrt to y-axis | Binarized partial derivative |
Gradient | Binarized Gradient |
Compare the second and third images. They're almost identical.
Binarized Gradient, low-pass then derivatives | Binarized Gradient, derivative of low-pass |
---|---|
Note that the landscape image below is very blurry, but the sharpening does quite a decent job at recovering details such as some of the branches in the top left and the shape of the trees.
Taj Mahal | Sharpened |
---|---|
Landscape | Sharpened |
Blur an image and then resharpen. The differences between these two is that there are noticeable "grains" of the sharpened image. But it does look much better when compared to the blurred image.
Chichen Itza |
---|
Blurred Original | Sharpened |
---|---|
Happy Hank | Angry Hank | Season 5 Episode 8 |
---|---|---|
The images with Hank made for the best result. Below are the frequency domain images. Note that the original two images have very similar frequency representation because they are very similar in the spatial domain.
Frequency of Happy | Filtered Frequency of Happy (High-Pass) |
---|---|
Frequency of Angry | Filtered Frequency of Angry (Low-Pass) |
Frequency of Hybrid |
---|
Other images.
McLaren F1 | La Ferrari | F1 World Champions |
---|---|---|
Happy | Sad | Saddy? |
Me | Rex | Joe in the 501st (Failure) |
Orapple Stack | The Orapple |
---|---|
Boeing 777 | Airbus 350 |
---|---|
Mask | Boeing 350 |
The mask used for this image is a simple left-half plane, similar to the one shown in the orapple stack. |
IRL couch | Lego Ahsoka |
---|---|
Ahsoka Mask | Lego Ahsoka IRL |
Below, note that the mask image is taken directly from the source image. However, my implementation increases the size of the mask image so that it's identical to the size of the larger image of the Bay Area.
Bay Area | Star Destroyer |
---|---|
Mask | Long Live the Empire |