Suppose I have a 256-by-256 input matrix called $X$ and two 3-by-3 kernels called $K_1$ and $K_2$. By the associativity of convolution

\begin{equation} (X \star K_1) \star K_2 = X \star (K_1 \star K_2) \end{equation}

I would like to calculate $K = K_1 \star K_2$ first and then form $X \star K$, because that is computationally cheaper. The problem is: how do I calculate $K_1 \star K_2$ in practice? I assume it will be a 5-by-5 kernel, but how do I handle the boundary where some corresponding elements don't exist?



You must log in to answer this question.

Browse other questions tagged .