Hi Niall,
"Without giving away your 'trade secrets', Juan, what does BN actually do to the image?"
There is no problem at all; I could even give you the source code of this process without any problems. Let me know if you are interested.
The BackgroundNeutralization task is actually very simple. For each nominal channel of the target image, let's define:
M
0 is the initial median value calculated for all
significant pixels. Significant pixels are those in the interval ]b
0,b
1], where b
0 and b
1 are the lower and upper limit parameters, respectively.
M
1 is the final median value. This value is the same for all channels (or otherwise we wouldn't be normalizing). In the
target background mode of BackgroundNeutralization, M
1 is a user-defined value (the target background value). In the other working modes, we always have M
1=0.
Then the neutralization phase consists of applying, for each pixel v
0:
v
1 = v
0 + M
1 - M
0Where v
1 is the corresponding neutralized pixel value. After neutralization, the three channels will have the same median to an accuracy that normally is better than 0.00001. The achieved accuracy depends on the existing dispersion of values on background areas.
After neutralization, note that the image can have negative pixels and also pixels greater than one. Hence, some type of normalization is necessary. The tool provides four options:
target background,
rescale,
rescale as needed and
truncate:
- In
target background mode any resulting out-of-range values will be truncated to the [0,1] interval, as this is the only way to force a user-defined,
fixed background. This can cause some data clippings but they are usually negligible. Only additive operations are applied to the image (the neutralization formula above).
- In
rescale mode the image will always be rescaled to keep all resulting pixel values while achieving a neutral background. In this mode you have no control over the final background values; you only know that the background will be neutral. Rescaling involves a multiplicative operation.
- In
rescale as needed mode the image will only be rescaled if there are negative pixel values. This mode provides a better control over the final background, for example if a small pedestal is added
before BackgroundNeutralization, in order to prevent negative values. This is the default mode.
- In
truncate mode all out-of-range values will be truncated. This will result in clippings, which can be important.