next up previous [pdf]

Next: Solution Up: Maurice: Tutorial Previous: Problem

1-D synthetic

step smooth
step,smooth
Figure 3.
(a) 1-D synthetic to test edge-preserving smoothing. (b) Output of conventional triangle smoothing.
[pdf] [pdf] [png] [png] [scons]

To better understand the effect of smoothing, you decide to create a one-dimensional synthetic example shown in Figure 3(a). The synthetic contains both sharp edges and random noise. The output of conventional triangle smoothing is shown in Figure 3(b). We see an effect similar to the one in the real data example: random noise gets removed by smoothing at the expense of blurring the edges. Can you do better?

spray local
spray,local
Figure 4.
(a) Input synthetic trace duplicated multiple times. (b) Duplicated traces shifted so that each data sample gets surrounded by its neighbors. The original trace is in the middle.
[pdf] [pdf] [png] [png] [scons]

To better understand what is happening in the process of smoothing, let us convert 1-D signal into a 2-D signal by first replicating the trace several times and then shifting the replicated traces with respect to the original trace (Figure 4). This creates a 2-D dataset, where each sample on the original trace is surrounded by samples from neighboring traces.

Every local filtering operation can be understood as stacking traces from Figure 4(b) multiplied by weights that correspond to the filter coefficients.

  1. Change directory to the project directory
    bash$ cd ../local
    
  2. Verify the claim above by running
    bash$ scons smooth.view smooth2.view
    
    Open the SConstruct file in a text editor to verify that the first image is computed by sfsmooth and the second image is computed by applying triangle weights and stacking. To compare the two images by flipping between them, run
    bash$ sfpen Fig/smooth.vpl Fig/smooth2.vpl
    
  3. Edit SConstruct to change the weight from triangle
    \begin{displaymath}
W_T(x) = 1-\frac{\vert x\vert}{x_0}
\end{displaymath} (1)

    to Gaussian
    \begin{displaymath}
W_G(x) = \exp{\left(-\alpha \frac{\vert x\vert^2}{x_0^2}\right)}
\end{displaymath} (2)

    Repeat the previous computation. Does the result change? What is a good value for $\alpha$?
  4. Thinking about this problem, you invent an idea[*]. Why not apply non-linear filter weights that would discriminate between points not only based on their distance from the center point but also on the difference in function values between the points. That is, instead of filtering by
    \begin{displaymath}
g(x) = \int f(y) W(x-y) dy\;,
\end{displaymath} (3)

    where $f(x)$ is input, $g(y)$ is output, and $W(x)$ is a linear weight, you decide to filter by
    \begin{displaymath}
g(x) = \int f(y) \hat{W}\left(x-y,f(x)-f(y)\right) dy\;,
\end{displaymath} (4)

    where and $\hat{W}(x,z)$ is a non-linear weight. Compare the two weights by running
    bash$ scons triangle.view similarity.view
    
    The results should look similar to Figure 5.
  5. The final output is Figure 6. By examining SConstruct, find how to reproduce this figure.
  6. EXTRA CREDIT If you are familiar with programming in C, add 1-D non-local filtering as a new MADAGASCAR module sfnonloc. Ask the instructor for further instructions.

triangle similarity
triangle,similarity
Figure 5.
(a) Linear and stationary triangle weights. (b) Non-linear and non-stationary weights reflecting both distance between data points and similarity in data values.
[pdf] [pdf] [png] [png] [scons]

nlsmooth
Figure 6.
Output of non-local smoothing
nlsmooth
[pdf] [png] [scons]

Figure 6 shows that non-linear filtering can eliminate random noise while preserving the edges. The problem is solved! Now let us apply the result to our original problem.


next up previous [pdf]

Next: Solution Up: Maurice: Tutorial Previous: Problem

2012-07-19