Low-frequency filter example.
The image filtering function processes each color channel of the given image separately. For each channel, it rearranges all possible blocks that the given filter can slide over into columns. The resulting column vector is then multiplied with the filter and then rearranged back to the intial dimensions. The new matrix is eventually included in the result as one of the filtered color channels.
The function treats vector-filters differently from matrix-filters by performing two 1D convolutions and avoiding the quadratic cost of 2D kernels. Regardless the filter though, the function follows the same basic functionality:
The details for each different filter distiction are listed below.
Hybrid image transitions.
When a vector filter is given, the padding is set as the length of the vector for both the extra rows and columns. Then for some channel, the padded image is rearranged into the column vector where the filter slides over, performing horizontal convolution. The resulting matrix is then convoluted vertically, hence resulting in the filtered channel.
For matrix filters, the padding is first calculated as the extra rows and columns needed for convolution, before converting the padded image into the column vector and applying the filter over it. The filtered column vector is rearranged back into the original dimensions and added to the result.
![]() ![]() ![]() ![]() |
![]() ![]() ![]() ![]() |
![]() ![]() |