Recovering original image from its edges

176 Views Asked by At

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.

1

There are 1 best solutions below

0
On BEST ANSWER

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.