1. Padding - I used padarray in symmetric mode, so the image was padded with reflections of itself.
2. Convolution - I then looped through the matrix multiplying each neighborhood with the filter and then adding it to a new matrix.
3. Un-Padding - Finally I assigned output to a spliced version of the new matrix with dimensions the same as the original matrix.
for color = 1:size(image,3)
for i=1+pad_x:col_pad_img_size-pad_x
for j=1+pad_y:row_pad_img_size-pad_y
tmp=filter.*pad_img(i-pad_x:i+pad_x,j-pad_y:j+pad_y, color);
out_img(i,j, color)=sum(tmp(:));
end
end
end
Low Frequencies | High Frequencies | Hybrid Images | Final Image | Cutoff Frequency |
---|---|---|---|---|
7 | ||||
4 | ||||
4 | ||||
4 | ||||
5 |