2
$\begingroup$

There are two mask filters,

f1 = np.array([[1, 1, 1],
               [1, 1, 1],
               [1, 1, 1]]) / 9


f2 = np.array([[1, 1, 1],
               [1, -8, 1],
               [1, 1, 1]])

I filter an input image using f2 and then filter the result with f1, how can I derive the filter mask that corresponds to the double filtering process?

I want to get a combine filter mask.

$\endgroup$

1 Answer 1

3
$\begingroup$

The convolution is associative: $(I * f_1) * f_2 = I * (f_1 * f_2)$.

In other words, applying the two filters in sequence to an image is equivalent to applying the convolution of the two filter kernels as a single filter to the image.

Simply convolve f1 with f2, making sure to extend the domain with zeros so that the output is not cropped.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.