Generates and exports colored visualizations of point cloud attribute (ODM) or raster models.
The module creates color coded data sets of point clouds (ODMs) and grid model files which help interpreting the content of the input source. The colorization can be done for one, two and three input channels revealing complex relations of the input source. Input channels correspond to coordiantes and attributes for ODMs and raster bands for grid files. In the grid file case, the module always creates a new color coded raster file. For ODMs, on the other hand,
two different output modes are implemented. The color values can either be directly stored within the ODM (standard case) (in the predefined attributes Red, Green and Blue) or a LAS-File containing the RGB-values (using Point Data Record Format 2) is created. In the latter case, the ODM is opened in read-only mode and stays unchanged.
Basically, coloring is a classification task dividing values into distinct classes and assigning a specific color to each class. Thus, the process can be split up in two parts: the definition of classes and the assignment of color values.
The main instrument for controlling both, the class definition and color assignment is the palette file (see Palette File Format, parameter palFile). Palette files always map the entire value range from - \(\infty\) to + \(\infty\), thus, the general form of the palette file is:
| Index | Color | Remark |
|---|---|---|
| - \(\infty\) | color0 | underflow color |
| index1 | color1 | index1 = index min |
| index2 | color2 | ... |
... | ... | ... |
| indexn | colorn | overflow color, index n = index max |
The palette file can be seen as a step function mapping values (index) to colors (value). Thematic maps mainly using irregular class boundaries (e.g. traffic-light-maps indicating good-medium-bad quality, maps of laser scanning strip differences indicating areas with good or bad consistency) can be derived easily that way. No interpolation of intermediate colors is performed as the classes of the output raster file exactly match the classes of the palette file. Another standard application is the derivation of color coded maps using continuous/equidistant classes and smooth color transitions. Therefore, additional parameters are provided to overrule the class division as given in the palette file. Equidistant classes can be defined by specifying a class interval (parameter interval) or a desired number of classes (parameter nClasses). In this case the palette is interpreted as a piecewise linear function and intermediate colors are interpolated in the center of each class to get a look-up-table. This is the intended way for deriving e.g. hypsometric views of the terrain.
By default, the indices of the palette file equal the values of the input channel. This transfer functions can be adapted by the optional parameter scalePal for each input channel separately. Linear transformation using offset and scale, linear stretching but also non-linear transformations like histogram equalization are supported. Necessary values can be either specified as absolute or percentage values as shown in the example section. Please note that multiple values have to be separated by comma and MUST NOT contain whitespaces, if not placed between double quotes. The following table gives a detailed list of how different transfer functions can be specified:
| scalePal Syntax | Example(s) | Description |
|---|---|---|
| <float> | 2.0 5 | A single float value is interpreted as scale. The class bounds are calculated using the following formula: class bound = index * <float> |
| <float_1>,offset=<float_2> | 2.5,offset=3 5,offset=-7 | Note: Syntax not defined/implemented yet. The class bounds are calculated using the following formula: class bound = index * <float_1> + <float_2> |
| <float_1>,<float_2> | 100,300 5%,95% | The class bounds are calculated by linear stretching the palette index domain (index min to index max) to the given reach (<float_1> to <float_2>). The same formula as above is applied (scale and offset are calculated internally). |
| <float_1>,...,<float_n> | 100,200,300 5%,50%,95% | The palette index domain (index min to index max) is equally split into n-1 intervals which are then mapped to the given values (<float_1> to <float_n>). Using relative values it is easy to realize a histogram equlization (e.g. 5%,25%,50%,75%,95%). Note: linear stretching (see above) is just a special case of the multiple value case. |
| auto | auto | The class bounds are calculated by stretching the palette index domain (index min to index max) to the valid data range. The same formula as above is applied (scale and offset are calculated internally). scalePal=auto is normally used together with palettes containing indices ranging from 0 to 100, allowing a percentage interpretation of the palette. |
Relative values are useful to achieve appealing continuous/equidistant colorizations when the input data contain gross errors and the relevant extents are not know. When ever needed, the module internally calls Module Histo to translate the percentage values to absolute values which are then used to build up the palette lookup tables.
The resulting color lookup table is output as a scalable vector graphics (SVG) file (see parameter legend).
Nomally, opalsColorize processes the entire area and the entire value range of the input channels. As possible for most modules, you can subselect the data by defining a filter and/or a limit. The parameter filter is used with point clouds (ODMs), the parameter limit can be used with grid models. Please consider that the limit parameter is of type opals::GridLimit (rather than just four double values). See the parameter description for further details.
Parameters for controlling the output are described in the following section:
Red, Green and Blue attribute per default. For directly creating a LAS-file (and keeping the ODM unchanged) specify oFormat las or set a corresponding output file (eg. output_rgb.las) using parameter outFile.Possible values: weightedAverage .... weighted average (low pass filter) simpleAverage ...... simple average (low pass filter) nearestNeighbour ... nearest neighbour bilinear ........... bi-linear interpolation bicubic ............ bi-cubic interpolation never .............. indicator avoiding resamplingMethod to be used for resampling the input grid to the specified pixelSize of the resulting raster image.
A palette file is a simple XML file containing an element <OpalsPalette> which itself contain the following elements:
<name> Optional<comment> Optional<classes> This optional element has a mandatory attribute val containing the number of classes to be used by default (if neither parameter interval nor parameter nClasses will be specified).<values> This element has a mandatory attribute type which value can be "RGB255" or "RGB".and 3 to 256 elements
<entry> Each of these elements must have the following attributes:val R red color component valueG green color component valueB blue color component valueand an optional attribute comment.
An image with indexed colors can contain no more than 256 colors. As we need a background color (BG) and one for values smaller than zmin (uf) and for values greater than zmax each, we can only have a maximum of 253 classes beetween zmin and zmax. If the number of classes specified by nClasses or calculated from other parameters is larger than 253 the resulting image will be a RGB-image.
Here is a simple example of a palette file:
The first two lines are only necessary to view the palette file with a WEB browser. The third line is a comment.
An OPALS distribution contains the following standard palettes:
standardPal.xml: used for terrain elevation codings (green land to brown mountains)
differencePal.xml: used for visualizations of (strip) differences (negative differences: blue, positive differences: red)
densityPal.xml: used for point density maps (poor density: red, yellow, satisfying density: green)
aspectPal.xml: terrain aspect
slopePal.xml: terrain slope
greyPal.xml: simple black-to-white palette for multiple purposes
Additional ColorBrewer palettes: ColorBrewer is providing cartographic color schemes
Implementation TODOs: - short examples for ODM case - dual input channel case
The data used in the subsequent examples are located in the $OPALS_ROOT/demo/ directory and the follwing preprocessing steps (data import, surface grid and difference model calculation) are required: