Hybrid Image of Dog and Cat
For project 1, we were required to write our own image filtering function and then filter images in different ways including blur, high frequency, low frequency, etc. We then used this filter function to create hybrid images, by taking low frequencies of an image and high frequencies of another and combining them. This results in an image that reflects the high frequency image up close, and the low frequency image from far away. My filtering function works as follows:
This snippet shows my iteration technique and how I chose to transform between padding pixel coordinates and final image coordinates
for z = 1:3
for x = xstart:xend
for y = ystart:yend
xind = x - xstart + 1;
yind = y - ystart + 1;
newmatrix = times(padimage((y-padrow:y+padrow),(x-padcol:x+padcol),z), filter);
avg = sum(sum(newmatrix))/sum(sum(filter));
newimage(yind, xind, z) = avg;
end
end
end
Original cat |
Large blur, sobel, laplacian, high pass |
Original cat and dog |
High frequency cat, low frequency dog, hybrid image |
Original Einstein and Marilyn |
High frequency Einstein, low frequency Marilyn, hybrid image |
The results of my filtering method are effectively the same as the imfilter() method ignoring floating point precision issues. The only thing I considered changing is my padding method to duplicate edges or something other than zero padding, because large filters result in a black edge which is pretty ugly when that isn't intended.
Additionally, the cat-dog hybrid image is computed with a cutoff_frequency of 7, whereas the einstein-marilyn hybrid image is computed with a cutoff_frequency of 4, as it resulted in a more balanced image.