0
$\begingroup$

I need to perform such a conversion to simplify my image processing problem (sharpening, in green are the knowns, in red the unknowns):

\begin{align} y(n,m) &= \color{green}{x(n,m)} * \left[ \color{red}{f_1(n,m) + f_2(n,m)} + \color{green}{f_3(n,m)}\right]\\ &= \color{green}{x(n,m) + kx(n,m) - x(n,m) * kg(n,m)} \end{align}

Notice that the convolution done here is two-dimensional. And I know that $$ f_3 = -kg ;$$ where $k$ is a constant. However, I could not find $f_1$ and $f_2$, I tried to use convolution Theorem to switch to FT then going back to time/spatial-domain but it did not obtain the same result. Here is a better explanation for the requested problem: image To perform such a process to an input image, instead of performing the three separated steps shown in the top figure, I need to find such a kernel; let's call f where $$ f = f_1 + f_2 + f_3 $$ and then convolve it directly with the input image to find the same output image described in the block diagram figure. Any help/idea?

$\endgroup$
  • $\begingroup$ Sorry, it's not quite clear what your given things are, and what things you are looking for. Could you state that in your question? $\endgroup$ – Marcus Müller Mar 7 at 15:58
  • $\begingroup$ I tried to describe it better now, my given things are x(n,m), k, and g(n,m). Things I want to find are f1,f2, and f3. $\endgroup$ – control is illusion Mar 7 at 16:05
0
$\begingroup$

Let's rearrange \begin{align} x(n,m) * \left[ f_1(n,m) + f_2(n,m) + f_3(n,m)\right] &= x(n,m) + kx(n,m) - x(n,m) * kg(n,m)\\ x(n,m) * \left[ f_1(n,m) + f_2(n,m) \right] &= x(n,m) + kx(n,m)\\ &=(1+k)x(n,m) \end{align} It directly follows from the linearity of convolution that $f_1+f_2=(1+k)\delta_{n,m}^{(N \times M)}$, where $\delta^{(N\times M)}$ is the Kronecker delta of the same size as your input $x$, i.e. an all-zero matrix with a 1 in the $0,0$ element; the neutral element for 2D-convolution.

So, it's possible to calculate what the sum of $f_1 + f_2$ is, but not the individual $f_1$ and $f_2$; $f_1= \delta^{(N\times M)}, f_2 = k\delta^{(N\times M)}$ is as correct as $f_1=\begin{pmatrix}1234 & 1 & \cdots &1\\0 & 0 & \cdots &0\\0 & 0 & \cdots &0\\\end{pmatrix},f_2=\begin{pmatrix}-1233+k & -1 & \cdots &-1\\0 & 0 & \cdots &0\\0 & 0 & \cdots &0\\\end{pmatrix}$.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks! It seems that this solution works fine. However, there is a slight difference between the histograms of output images obtained from two methods. I think theoretically they should match each other, but may be Python calculations lead to some precision loss. Moreover, I think that delta matrix should the size of G not X since the size of G < X we need a kernel of the same size as the Gaussian Filter size is. $\endgroup$ – control is illusion Mar 7 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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