Imagery data sometimes uses just a limited range of the complete image bit depth to express its values. This is typically the case with images that have a large bit depth, such as HDR imagery. The range of possible values increases, and therefore also the likelihood that only a limited range of values is used. When those values get mapped to colors for visualization, the typical result is a dark or almost black image. To create a better image, you can include a raster normalization step.

Using the image processing API, you can programmatically apply normalization operations to your raster. An alternative approach is to rely on OGC SLD/SE styling and define a normalization style:

Program: Defining a raster normalization style
<FeatureTypeStyle xmlns="http://www.opengis.net/se"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://www.opengis.net/se http://schemas.opengis.net/se/1.1.0/FeatureStyle.xsd"
                  version="1.1.0">
  <Name>raster_normalization_style</Name>
  <Rule>
    <Name>raster_normalization_styling_rule</Name>
    <RasterSymbolizer>
      <ContrastEnhancement>
        <Normalize/>
      </ContrastEnhancement>
    </RasterSymbolizer>
  </Rule>
</FeatureTypeStyle>

The Normalize operator triggers a pixel rescale operation to make the image properly visible. This operation needs a normalization interval that indicates the current range of the image. In Program: Defining a raster normalization style, the normalization interval is calculated automatically. The calculation consists of a histogram operation, followed by a cumulative count cut filter to remove outliers outside the 2% - 98% interval.

You can also set the normalization interval manually, using the vendor-specific parameters minValue and maxValue. You can set these values for the entire image, as shown in Program: Defining a raster normalization style with a global normalization interval, or you can set a specific interval for each band, as shown in Program: Defining a raster normalization style with a normalization interval per band:

Program: Defining a raster normalization style with a global normalization interval
<FeatureTypeStyle xmlns="http://www.opengis.net/se"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://www.opengis.net/se http://schemas.opengis.net/se/1.1.0/FeatureStyle.xsd"
                  version="1.1.0">
  <Name>raster_normalization_style</Name>
  <Rule>
    <Name>raster_normalization_styling_rule</Name>
    <RasterSymbolizer>
      <ContrastEnhancement>
        <Normalize>
          <VendorOption name="minValue">409</VendorOption>
          <VendorOption name="maxValue">3268</VendorOption>
        </Normalize>
      </ContrastEnhancement>
    </RasterSymbolizer>
  </Rule>
</FeatureTypeStyle>
Program: Defining a raster normalization style with a normalization interval per band
<FeatureTypeStyle xmlns="http://www.opengis.net/se"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://www.opengis.net/se http://schemas.opengis.net/se/1.1.0/FeatureStyle.xsd"
                  version="1.1.0">
  <Name>raster_normalization_style</Name>
  <Rule>
    <Name>raster_normalization_styling_rule</Name>
    <RasterSymbolizer>
      <ChannelSelection>
        <RedChannel>
          <SourceChannelName>1</SourceChannelName>
          <ContrastEnhancement>
            <Normalize>
              <VendorOption name="minValue">544</VendorOption>
              <VendorOption name="maxValue">3268</VendorOption>
            </Normalize>
          </ContrastEnhancement>
        </RedChannel>
        <GreenChannel>
          <SourceChannelName>2</SourceChannelName>
          <ContrastEnhancement>
            <Normalize>
              <VendorOption name="minValue">409</VendorOption>
              <VendorOption name="maxValue">3416</VendorOption>
            </Normalize>
          </ContrastEnhancement>
        </GreenChannel>
        <BlueChannel>
          <SourceChannelName>3</SourceChannelName>
          <ContrastEnhancement>
            <Normalize>
              <VendorOption name="minValue">495</VendorOption>
              <VendorOption name="maxValue">3256</VendorOption>
            </Normalize>
          </ContrastEnhancement>
        </BlueChannel>
      </ChannelSelection>
    </RasterSymbolizer>
  </Rule>
</FeatureTypeStyle>

If you save these styles in a .sld file with the same file name as the raster data file, and store it next to that raster file in the same folder, it is picked up automatically when the raster data is opened in Lucy or Lucy Map Centric.

See Styling data with OGC SLD for more information about using and applying OGC SLD/SE styling.