Example of a right floating element.
My implementation extended the image first by adding zeros. This was done by calling an individual function called image_extension, which returns the extended image and margin sizes. The helper function would calculate the size of the image and the filter, create a zero matrix with extended size, and copy the original matrix to the center of the new matrix. The main function then run convolution on each pixel. For each pixel, it first sliced out the area of intereste, re-arranged the area and filter matrices to 1d vectors, and then performed dot production.
dim = length(size(image));
output = zeros([size(filter), ones(1,dim-2)]+ size(image)- 1);
if dim == 3
output(1+ margin_filter(1): size_image(1)+ margin_filter(1), 1+ margin_filter(2): size_image(2)+ margin_filter(2),:)= image;
elseif dim == 2
output(1+ margin_filter(1): size_image(1)+ margin_filter(1), 1+ margin_filter(2): size_image(2)+ margin_filter(2))= image;
end
If one of the two images is colorful whereas the other one is soft, use the colorful image as high_frequency image and the other one as low_frequency image. Otherwise, the colorful image will maintain its high contrast color as low_frequency image, which will mask the other one even when the image is very large or closed to the eyes.
Row 1: Identity Filter, Small Blur Filter, Large Blur Filter, Sobel_Filter
Row 2: Laplacian Filter, High Pass Image, High Freq Image, Low Freq Image
Row 3: Other Hybrid Images