Suppose we read an image $X$ with $1\times P$ dimensions (a single row and $P$ columns) and apply to it the simplest edge detector, that calculates the horizontal derivative say, $F = [1, 0, −1]$ to get $Y$. Is it possible to go back to retrieve $X$ from $Y$? Given that $$Y_n = X_{n−1}−X_{n+1}$$ can you express $X$ in terms of $Y$? Can we design a $3\times 3$ filter $G$ that performs the opposite of $F$? we must consider both spatial and frequency domains. considering the spatial domain, we must try to find a convolution filter that fulfills our task. while considering the frequency domain, we must try to find an expression that can help us solve the problem. Here Frequency domain means that if we Fourier transform of our image and apply convolution to it will it get us any closer to the solution.

  • $\begingroup$ No, $F$ has the same output when applied to $[0,0,0,0,\dots]$ and $[1,0,1,0,1,0,\dots]$. $\endgroup$ – Rahul Feb 15 at 8:34
  • $\begingroup$ X1= Y0 + X-1 => X2= Y1 + X0 => X3= Y2 + X1 = Y2 + Y0 + X-1 => X4= Y3 + X2 = Y3 + Y1 + X0 => X5= Y4 + X3 = Y4 + Y2 + Y0 + X-1 => X6= Y5 + X4 = Y5 + Y3 + Y1 + X0 what about this approach. can this be turned into a convolution filter $\endgroup$ – Muhammad Hanif Sarwari Feb 15 at 8:36
  • $\begingroup$ it is an image we are only applying our filter in a horizontal direction. $\endgroup$ – Muhammad Hanif Sarwari Feb 16 at 20:25
  • $\begingroup$ I'll make it more clear by adding more details to it. $\endgroup$ – Muhammad Hanif Sarwari Feb 17 at 15:19
  • $\begingroup$ i have been busy. i'll make sure i post an update in next 24 hours $\endgroup$ – Muhammad Hanif Sarwari Feb 20 at 17:41

Let $X$ be an image of dimensions $1 \times N$, and denote with $X_n, n \in \{0, \ldots, N - 1\}$ the value of pixel $n$ of $X$. By applying the filter $F = [1, 0, -1]$ to $X$, we obtain an image $Y$ of dimensions $1\times (N-2)$. Let we denote with $Y_n, n \in \{1, \ldots, N - 2\}$ the value of pixel $n$ of $Y$.

The application of $F$ to $X$ corresponds to the application of the following rule: $$Y_n = X_{n-1} - X_{n+1},\ n \in \{1, \ldots, N-2\}.$$

To obtain $X$ from $Y$ we can proceed by inverting the last formula: $X_{n+1} = X_{n-1} - Y_n $, that with a substitution ($n = n+1, n \in \{2, \ldots, N-1\} $) becomes $$X_{n} = X_{n-2} - Y_{n-1}. $$

We can immediately observe that $X_{0}, X_{1} $ cannot be defined in this way.

By applying recursively this rule we obtain $$X_{n} = X_{n-2} - Y_{n-1} = (X_{n-4}- Y_{n-3}) - Y_{n-1} = ((X_{n-6} - Y_{n-5}) - Y_{n-3}) - Y_{n-1} = \cdots,$$ that we can write as:

$$X_{n} = \begin{cases} X_{0} - \displaystyle\sum_{i = 0}^{\frac{n}{2}-1}Y_{2i+1}, & \mbox{if } n\mbox{ is even,} \\ X_{1} - \displaystyle\sum_{i = 1}^{\frac{n-1}{2}}Y_{2i}, & \mbox{if } n\mbox{ is odd.} \end{cases}$$

We can therefore retrieve $X$ from $Y$ if and only if we have the additional info about $X_0$ and $X_1$. If you consider the application of the filter $F$ as a method for deriving an image, the procedure of retrieving the original image from its derivative is analogous to integration. The integral results to be unique if and only if boundary conditions (in this case $X_0$ and $X_1$) are given.

As for the last question, it is not possible to retrieve $X$ by using a convolution filter directly on $Y$. This is due to the fact that $X_n$ cannot be expressed only in terms of $Y_{n-1}$, $Y_{n}$ and $Y_{n+1}$. Maybe an auxiliary image $Z$ of dimensions $1 \times (N+2)$ could be prepared for obtaining $X$ as a result of a convolution filter.


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.