-
Notifications
You must be signed in to change notification settings - Fork 31
op normalize
Mathematically, normalization scales the intensity of image pixels relative to a given normalization value (typically 1) and type (typically NORM_L2). Normalization provides a valuable standard of comparison and is implemented by OpenCV normalize.
Normalization can also be used for contrast shifting and scaling to focus on "pixel values of interest" and is a great visual aid for interpreting images. FireSight extends OpenCV with a domain parameter that lets you choose a range of pixel intensities of interest (see Example 3).
-
alpha Norm value to normalize to or the lower range boundary in case of the range normalization. Default is
1
unless image is 8-bit, in which case FireSight will automatically compute a good value. - beta Upper range boundary in case of the range normalization; it is not used for the norm normalization. Only used for NORM_MINMAX.
- normType normalization type (NORM_L2 (default), NORM_L1, NORM_MINMAX, NORM_INF).
For 8-bit images, FireSight provides two parameters which are much more convenient to use than alpha and beta:
-
domain JSON array of integers describing value interval to normalize. Default is
[0,255]
. Values outside this interval will be eliminated from pipeline image by truncating and shifting image values. This works for all normalization types and is useful for focusing on a value interval of interest. -
range JSON array of integers describing output value interval. Default is
[0,255]
, which maximizes the dynamic range of the normalized output. This is rarely used.
{}
The examples below use the following test image.
The test image has pixel values in the range [0,255] with a background pixel value of 32.
Within the test image are letters in the grayscale range [20,52].
The letters are difficult to see with the naked eye:
Example 1: Show ABC pipeline
firesight -i img/abc.png -p json/normalize.json -o target/normalize.png
The default NORM_L2 normalization reveals the letters hidden in the test image.
Example 2: High Contrast ABC pipeline
firesight -i img/abc.png -p json/normalize.json -o target/normalize.png -Ddomain=[20,52]
By choosing a domain that matches the values used to represent the letters, we eliminate uninteresting dark/light values. This allows us to increase the image gain and bias it toward the value interval of interest:
The following table illustrates the utility of the various normType options. It also shows how the domain interval can improve contrast.
normType | no domain | domain=[20,52] | no domain | domain=[164,196] |
---|---|---|---|---|
NORM_MINMAX | ||||
NORM_INF | ||||
NORM_L1 | ||||
NORM_L2 |