Image Filtering is a technique of modifying or enhancing an image. It includes emphasizing certain features and involves techniques like smoothing, sharpening, edge enhancement. For this particular project, our own version of matlab function imfilter(A,h) is implemented. Several filtering techniques are tested on a cat image as shown below:
Original |
Blur |
Large Blur |
Sobel |
High Pass (Laplacian) |
High Pass (Alternative) |
Matlab code snippet for filtering:
for k = 1:im_z
for i = 1:im_x
for j = 1:im_y
A = (padded_img(i:i+filter_x_dim-1,j:j+filter_y_dim-1, k).*filter);
output(i,j,k) = sum(A(:));
end
end
end
Code is present in code/my_imfilter.m file
A hybrid image is an image that is perceived in one of two different ways, depending on viewing distance, based on the way humans process visual inputs. Hybrid images combine the low spatial frequencies of one picture with high spatial frequencies of another picture, producing an image with an interpretation that changes with viewing distance.
Looking at picture from a short distance, one can see sharp image and high frequency picture dominates. When viewed from distance in which fine detail blurs, low frequncy image dominates.
For the project, several example pairs are tested with different cut-off frequncies for the filter to get the best optical illusion:
Cut off Frequency = 8
Dog (Low Frequency) |
Cat (High Frequency) |
Hybrid Image Scales |
Cut off Frequency = 3.5
Marilyn (Low Frequency) |
Einstein (High Frequency) |
Hybrid Image Scales |
Cut off Frequency = 5
Fish (Low Frequency) |
Submarine (High Frequency) |
Hybrid Image Scales |
Observation: On trying fish with high frequency filter and submarine with low frequency filter, submarine image was not very clear at low frequencies, so tried with the other combination.
Cut off Frequency (Low frequency filter) = 6
Cut off Frequency (High frequency filter) = 8
Motorcycle (Low Frequency) |
Bicycle (High Frequency) |
Hybrid Image Scales |
Observation: Could not get very clear image of bicycle (at high frequency) with different cut-off frequencies. Then tried with different set of cut-off frequencies for low pass and high pass filters. Low frequency image, motorcycle, looks much better with this change.
Cut off Frequency = 8
Plane (Low Frequency) |
Bird (High Frequency) |
Hybrid Image Scales |
Cut off Frequency = 8
Derek (Low Frequency) |
Nutmeg (High Frequency) |
Hybrid Image Scales |
Observation: Professor showed the hybrid image of Derek and Nutmeg in class. Needed to resize and rotate the images before generating the output shown above.
Implemented both parts of the project, i.e., Image Filtering and Hybrid Images.
In Image Filtering, implemented own version of imfilter matlab function and tested with different filtering techniques like blurring, sobel, etc.
In Hybrid Image, the three output images are presented for each pair of input images. First output image is passed through low pass filter, the second output one through high pass filter. In third output image, i.e. hybrid image scales, the leftmost image shows the high frequency image, rightmost the low frequency image and in the middle hybrid image can be observed.