Madagascar tutorial |

step,smooth
(a) 1-D synthetic to test edge-preserving smoothing. (b) Output of conventional triangle smoothing.
Figure 3. |
---|

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
(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.
Figure 4. |
---|

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.

- Change directory to the project directory
bash$ cd ../local

- 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, runbash$ sfpen Fig/smooth.vpl Fig/smooth2.vpl

- Edit
`SConstruct`to change the weight from triangle

to Gaussian

Repeat the previous computation. Does the result change? What is a good value for ? - 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

where is input, is output, and is a linear weight, you decide to filter by

where and is a non-linear weight. Compare the two weights by runningbash$ scons triangle.view similarity.view

The results should look similar to Figure 5. - The final output is Figure 6. By examining
`SConstruct`, find how to reproduce this figure. **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
(a) Linear and stationary triangle weights. (b) Non-linear and non-stationary weights reflecting both distance
between data points and similarity in data values.
Figure 5. |
---|

nlsmooth
Output of non-local smoothing
Figure 6. | |
---|---|

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.

Madagascar tutorial |

2012-07-19