Keywords:

Summary

This demo includes examples of using the CurveMap and ENVI Spectral Library (SLI) files to define scene objects with spectral variability. The scene contains a Macbeth Color Checker type panel that is flanked by a pair of grass patches. The left patch is modeled with the classic DIRSIG texture method and the right patch emulates it with a CurveMap.

demo

The following demos, manuals and tutorials can provide additional information about the topics at the focus of this demo:

  • Related Demos

    • None.

  • Related Manuals

  • Related Tutorials

    • None.

Details

Since a CurveMap is responsible for assigning curves to locations in the scene and since those curves could be for different material classes, represent variation within a given material class, or both it can be considered either a material manipulation map or optical property map. In this demo, this map type will be used as a "material map" by mapping different color panels into a Macbeth Color Checker panel and as an optical property map by mapping different grass curves into a patch of grass.

The CurveMap can be used as an alternative to the classic DIRSIG texture map approach to create spatial-spectral variability in a material class. That approach used a database of spectral curves and an image of that material in some wavelength window (or windows) and then a statistical mechanism to figure out which curves get mapped to which pixels. The CurveMap is a "direct" mapping approach where the map image digital counts (DCs) are interpreted as an index into a database of curves. Since it is a direct mapping mechanism (rather than using the indirect statistical approach) this approach might be favored for some scene construction tasks.

Important Files

This section highlights key files important to the simulation.

The Macbeth Color Checker Panel

The central object in the scene is a variant of a Macbeth Color Checker used for color calibration of imaging and display systems.

The Zero Offset Curve Map

The panel is created using a hand-made PGM index image that lays out the 6 x 4 grid of panels:

The ASCII/Text PGM image file to layout the 6 x 4 grid of panels.
P2
6 4
255
 0  1  2  3  4  5
 6  7  8  9 10 11
12 13 14 15 16 17
18 19 20 21 22 23
Note
The map image file for a CurveMap can be any supported image file format. For this demonstration, it was useful to employ a hand-crafted ASCII/Text PGM file to show the indexes used in this map.

The Non-Zero Offset Curve Map

A second image PGM image file is included that has all the pixels offset (with respect to the first one) by 100.

The offset ASCII/Text PGM image file to layout the 6 x 4 grid of panels.
P2
6 4
255
100 101 102 103 104 105
106 107 108 109 110 111
112 113 114 115 116 117
118 119 120 121 122 123

These index maps are used to map spectral reflectance curves from an ENVI Spectral Library (SLI) file (see materials/macbeth.sli). The plot below shows the 24 color checker curves that can be individually extracted from SLI file the using the sli_tool:

$ sli_tool extract --index=0 macbeth.sli > macbeth_0.txt
macbeth curves
Figure 1. Plot of the Macbeth Color Checker reflectance curves.

The geometry for this panel is define in the geometry/demo.scene file using a 1x1 meter OBJ file that is scaled to a 6 x 4 aspect ratio so the map is not distorted when UV mapped onto the geometry:

GLIST file entry for the zero-offset Macbeth Color Checker geometry.
  <object enabled="true">
    <basegeometry>
      <obj>
        <filename>1x1.obj</filename>
        <assign name="macbeth" id="macbeth">default</assign>
      </obj>
    </basegeometry>
    <staticinstance tags="panel">
      <translation>
        <point><x>0</x><y>+2.1</y><z>0.01</z></point>
      </translation>
      <scale>
        <cartesiantriple><x>6</x><y>4</y><z>1</z></cartesiantriple>
      </scale>
    </staticinstance>
  </object>

The non-zero offset curve index map is indentical, except it maps to a separate material:

GLIST file entry for the zero-offset Macbeth Color Checker geometry.
  <object enabled="true">
    <basegeometry>
      <obj>
        <filename>1x1.obj</filename>
        <assign name="macbeth_offset" id="macbeth_offset">default</assign>
      </obj>
    </basegeometry>
    <staticinstance tags="panel">
      <translation>
        <point><x>0</x><y>-2.1</y><z>0.01</z></point>
      </translation>
      <scale>
        <cartesiantriple><x>6</x><y>4</y><z>1</z></cartesiantriple>
      </scale>
    </staticinstance>
  </object>

The zero offset curve map is configured in the materials/demo.mat material file:

Material file entry for the zero offset Macbeth Color Checker material.
MATERIAL_ENTRY {
    NAME = Macbeth Color Panel (via CurveMap)
    ID = macbeth
    EDITOR_COLOR = 1.0000, 1.0000, 1.0000
    DOUBLE_SIDED = TRUE

    RAD_SOLVER_NAME = Simple
    RAD_SOLVER {
        QUALITY = LOW
    }

    SURFACE_PROPERTIES {
        REFLECTANCE_PROP_NAME = CurveMap
        REFLECTANCE_PROP {
            SLI_FILENAME = materials/macbeth.sli
            SLI_INDEX_OFFSET = 0
            IMAGE_FILENAME = macbeth.pgm
            UV_PROJECTOR {
                ORIGIN = IMAGE
                FLIPX = FALSE
                FLIPY = FALSE
                EXTENDX = MIRROR
                EXTENDY = MIRROR
            }
        }
    }
}

The non-zero offset curve map is configured in the materials/demo.mat material file. The key difference is that the SLI_INDEX_OFFSET is set to -100, which maps all the PGM values in that back to the same indexes into the SLI as the zero offset curve map configuration:

Material file entry for the non-zero offset Macbeth Color Checker material.
MATERIAL_ENTRY {
    NAME = Macbeth Color Panel (via CurveMap w/ Offset)
    ID = macbeth_offset
    EDITOR_COLOR = 1.0000, 1.0000, 1.0000
    DOUBLE_SIDED = TRUE

    RAD_SOLVER_NAME = Simple
    RAD_SOLVER {
        QUALITY = LOW
    }

    SURFACE_PROPERTIES {
        REFLECTANCE_PROP_NAME = CurveMap
        REFLECTANCE_PROP {
            SLI_FILENAME = materials/macbeth.sli
            SLI_INDEX_OFFSET = -100
            IMAGE_FILENAME = macbeth_offset.pgm
            UV_PROJECTOR {
                ORIGIN = IMAGE
                FLIPX = FALSE
                FLIPY = FALSE
                EXTENDX = MIRROR
                EXTENDY = MIRROR
            }
        }
    }
}

In summary, each pixel in the PGM image (values ranging from 0 to 23 are interpreted as indexes into the SLI file.

Tip
If the SLI file contains other curves, the SLI_INDEX_OFFSET can be used to shift the indexes pulled from the map when using them to access the SLI file. For example, if the corresponding curves for this panel were curves 100 - 123 (rather than 0 - 23) in the SLI file, then setting the SLI_INDEX_OFFSET to 100 would shift the image map indexes appropriately.

The Grass Panels

Flanking the color checker panel is a pair of panels that have been assigned grass materials. The panel on the left side is configured using the classic DIRSIG "texture map" approach to introduce spatial-spectral variability in the grass. This setup requires an image file that is used to define the relative brightness of the material in a known spectral band. These relative brightnesses are then used via a statistical mechanism to choose curves in a spectral reflectance database that reproduce those relative variations in that spectral band. Consult the texture map documentation for a deeper explanation of this mechanism. The setup for this material in the materials/demo.mat file is shown below:

Material file entry for the texture mapped grass material.
MATERIAL_ENTRY {
    NAME = Macbeth Color Panel (via CurveMap w/ Offset)
    ID = macbeth_offset
    EDITOR_COLOR = 1.0000, 1.0000, 1.0000
    DOUBLE_SIDED = TRUE

    RAD_SOLVER_NAME = Simple
    RAD_SOLVER {
        QUALITY = LOW
    }

    SURFACE_PROPERTIES {
        REFLECTANCE_PROP_NAME = CurveMap
        REFLECTANCE_PROP {
            SLI_FILENAME = materials/macbeth.sli
            SLI_INDEX_OFFSET = -100
            IMAGE_FILENAME = macbeth_offset.pgm
            UV_PROJECTOR {
                ORIGIN = IMAGE
                FLIPX = FALSE
                FLIPY = FALSE
                EXTENDX = MIRROR
                EXTENDY = MIRROR
            }
        }
    }
}

MATERIAL_ENTRY {
    NAME = Grass (w/ TextureMap)
    ID = grass_texture_map
    EDITOR_COLOR = 1.0000, 1.0000, 1.0000
    DOUBLE_SIDED = TRUE

    RAD_SOLVER_NAME = Simple

The right-side panel is configured using a curve map. One of the uses of this map type is as an alternative to the classic texture map approach used with the left-side panel. Rather than abstract the pixel to curve look-up through statistical method, the curve map uses the map digital counts (DCs) to directly index the curves. How this index map is created is up to the user and would most likely be created using external tools.

For the purpose of this demo, the right-side grass panel using a curve map setup was carefully constructed to reproduce the left-side grass panel that employs the texture map method. To achieve this, the curve indexes determined by the statistical mechanism employed by the texture map method were extracted from a DIRSIG scene HDF file of a scene that only contained the texture mapped grass. These extracted curve indexes were converted to an index image (see maps/grass_curve_map.png).

Important
The details of creating the index map for this panel by extracting data from a DIRSIG scene HDF are not relevant. It was only done to show that the curve map can be used as an alternative to the classic texture map approach. In operation, the user employing a curve map like this would have their own algorithm for creating the curve map.

The materials/grass_curves.ems file used with the texture mapped grass material was converted to an SLI file using the sli_tool:

$ sli_tool convert grass_curves.ems --output grass_curves.sli
Note
The sli_tool automatically converts DIRSIG spectral emissivity files to reflectances.

The extracted curve index map and the converter spectral curve library are then combined to form the curve map configuration in the material file:

Material file entry for the curve mapped grass material.
        QUALITY = LOW
    }

    SURFACE_PROPERTIES {
        EMISSIVITY_PROP_NAME = ClassicEmissivity
        EMISSIVITY_PROP {
            FILENAME          = grass_curves.ems
            SPECULAR_FRACTION = 0
            TEXTURE_MAP {
                IMAGE_LIST {
                    IMAGE {
                        FILENAME = grass_texture_map.pgm
                        MIN_WAVELENGTH = 0.4
                        MAX_WAVELENGTH = 0.7
                    }
                }
                UV_PROJECTOR {
                    ORIGIN = IMAGE
                    FLIPX = FALSE
                    FLIPY = FALSE
                    EXTENDX = MIRROR
                    EXTENDY = MIRROR
                }
            }
        }
    }
}

Simulations and Results

The primary simulation for this demo is defined by the demo.jsim file and can be run from the command line:

$ scene2hdf demo.scene
$ dirsig5 demo.jsim

An RGB visualization of the output radiance image can be created using either a graphical image viewer or using the DIRSIG image_tool utility as shown below:

image_tool convert --autoscale=gamma --format=png demo.img
The RGB image (using gamma scaling) of the scene.

demo

The Dominant Material Index truth image will show that the three panels are consider thee unique materials to DIRSIG. This should not surprise anyone as the material file represents them as three unique entries:

DIRSIG "Dominant Material Index" truth image:

material index truth

The Dominant Optical Property Index truth image will indicate the index within each of those materials. This index space is shared across all materials, so the Macbeth panel will contain 24 unique indexes and each grass material will contain 50+ unique indexes.

DIRSIG "Dominant Optical Property Index" truth image:

curve index truth