Factoring $2D$ correlation into $2\ 1D$ correlations

33 Views Asked by At

I'm trying to factor out a $2D$ correlation into two $1D$ correlations, but run into a problem when trying to solve for coefficients.

Say I have an image

\begin{bmatrix} I_{00} & I_{01} \\ I_{10} & I_{11} \end{bmatrix}

And a kernel

\begin{bmatrix} k_{00} & k_{01} \\ k_{10} & k_{11} \end{bmatrix}

My correlation would then be

$$k_{00}*I_{00} + k_{01}*I_{01} + k_{10}*I_{10} + k_{11}*I_{11} \tag{1}$$

I now want to factor this out into first correlating image I with a column vector

\begin{bmatrix} a_{0} \\ a_{1} \end{bmatrix}

followed by a correlation with a row vector

\begin{bmatrix} b_{0} & b_{1} \end{bmatrix}

First correlation would yield a row vector

\begin{bmatrix} a_0*I_{00} + a_1*I_{10} & a_0*I_{01} + a_1*I_{11} \end{bmatrix}

and correlating that with kernel b would yield a single scalar

$$(a_0*b_0*I_{00}) + (a_0*b_1*I_{01}) + (a_1*b_0*I_{10}) + (a_1*b_1*I_{11})$$

that should be equal to equation (1). Since this has to be true for any image I, it seems to me I can say that:

$$a_0 * b_0 = k_{00} \tag{2}$$ $$a_0 * b_1 = k_{01} \tag{3}$$ $$a_1 * b_0 = k_{10} \tag{4}$$ $$a_1 * b_1 = k_{11} \tag{5}$$

and as ks are given, I have a system of 4 equations for 4 unknowns that can be solved for as and bs that would yield same response as single 2D kernel k.

However when I try to solve above, I always find that my bs are 0 and as are infinite...

Say I equate $a_0$ from equations (2) and (3) to get

$$\frac{k_{00}}{b_0} = \frac{k_{01}}{b_1} \tag{6}$$

and similarly $a_1$ from equations (4) and (5) to get

$$\frac{k_{10}}{b_0} = \frac{k_{11}}{b_1} \tag{7}$$

I can now transform $b_1$ from equation (6) to

$$b_1 = \frac{k_{01}*b_0}{k_{00}}$$

and similarly from equation (7) to

$$b_1 = \frac{k_{11}*b_0}{k_{10}}$$

so that

$$\frac{k_{01}*b_0}{k_{00}} = \frac{k_{11}*b_0}{k_{10}}$$

which after transformations yields

$$b_0 * (k_{01}*k_{10} - k_{00}*k_{11}) = 0$$

which for generic ks that aren't constrained in any way is only true when $b_0 = 0$, from which follows that $b_1 = 0$ and as are infinite, which obviously isn't true. So where did I stray?

1

There are 1 best solutions below

1
On

I tried taking the log of both sides of all four derived equations so we have a linear system of equations:

$$log(a_0) + log(b_0) = log(k_{00}) \tag{2}$$ $$log(a_0) + log(b_1) = log(k_{01}) \tag{3}$$ $$log(a_1) + log(b_0) = log(k_{10}) \tag{4}$$ $$log(a_1) + log(b_1) = log(k_{11}) \tag{5}$$

In matrix form, we get

$$\begin{bmatrix} 1 & 0 & 1 & 0 \\ 1 & 0 & 0 & 1 \\ 0 & 1 & 1 & 0 \\ 0 & 1 & 0 & 1 \end{bmatrix} \begin{bmatrix} log(a_0) \\ log(a_1) \\ log(b_0) \\ log(b_1) \end{bmatrix} = \begin{bmatrix} log(k_{00}) \\ log(k_{01}) \\ log(k_{10}) \\ log(k_{11}) \end{bmatrix}$$

In order to solve for each of the variables we would normally multiply both sides by the inverse of the 4x4 matrix on the left and then exponentiate, but we cannot in this situation because the matrix is singular, which means that one of your variables in $a_0, a_1, b_0, b_1$ is a free variable whose value you are free to choose.