nlg2d.4 : Edge preserving smoother in 2D
-------------------------------------------------------
This is a modification of the non-linear Gaussian filter chain which is very fast
compared to previous versions.
The usage has changed: Input is stdin and Output is stdout.
Hence the filter can be used as pipe.
Usage: nlg2d.4 command_list
An image in PGM(P5)-format is read from stdin, and then the commands in the list are
interpreted and performed one after the other from left to right; at the end the result
written to stdout.
Commands:
-f [SigmaX SigmaY SigmaZ]
Filter the result of the previous filter step (resp. the input)
using the given parameters SigmaX, SigmaY, and SigmaZ. If no
parameters are given then the previous values are changed
according to SigmaX=2*SigmaX, SigmaY=2*SigmaY, SigmaZ=SigmaZ/2.
-F WidthX WidthY SigmaZ
Perform a modified filter step i.e. the filter
weights are calculated as with the option -f, but the
image which is filtered is the original input image,
not the result of the previous filter step.
The spatial weights are not gaussian, but constant.
-d SigmaX SigmaY thresh ampl [width]
Perform a nonlinear DOG filter. The filter result is a signed
image signal which is first multiplied by the parameter ampl,
then shifted by 128 and limited by 0 resp. 255 in order to
yield a nonnegative image with values in the range [0,255].
Hence sign changes correspond to changes from values <128 to
values >128. Locations where those changes occur are edges.
The filter operation neglects gray value differences the absolute
value of which is below the parameter thresh. This nonlinear
modification prevents the filter to respond to small gray value
variations. Hence apart of the image edges the output is exactly
zero (resp. 128).
A rectangular mask of (width*SigmaX)x(width*SigmaY) is used.
Typical filter chains:
----------------------
nlg2d.4 -f 1 1 16 -f -f < lena.pgm > lenasmooth.pgm
nlg2d.4 -f 1 1 48 -f 2 2 16 -f -f < lena.pgm > lenasmoother.pgm
The SigmaZ of the first filter stage should be approximately three times the standard
deviation of the noise of the input signal. Usually 3 to 6 stages suffice.
NOTE that the modified filter step F takes much time! In most cases it is not really
needed and can be omitted. Its main effect is to reconstruct the values of small image
structures more exactly.