[gdal-dev] VRT image definition and LUT stretch

Tamas Szekeres szekerest at gmail.com
Sun Apr 20 16:45:25 EDT 2008


Armin,

As far as I know mapserver transforms the scale min/max values to the
0-255 range of the values. So by using the VRT ComplexSource the
following 2 options can possibly be used:

Option 1:

  <VRTRasterBand dataType="Byte" band="1">
    <ColorInterp>Red</ColorInterp>
    <ComplexSource>
      <LUT>117:0,339:255</LUT>
      <SourceFilename>src.tif</SourceFilename>
      <SourceBand>1</SourceBand>
    </ComplexSource>
  </VRTRasterBand>

Option 2:

<VRTRasterBand dataType="Byte" band="1">
    <ColorInterp>Red</ColorInterp>
    <ComplexSource>
      <ScaleOffset>-134.919</ScaleOffset>
      <ScaleRatio>1.153</ScaleRatio>
      <SourceFilename>src.tif</SourceFilename>
      <SourceBand>1</SourceBand>
    </ComplexSource>
  </VRTRasterBand>

Where:

ScaleRatio = 256/(scaleMax-scaleMin)
ScaleOffset = -ScaleRatio*scaleMin

Best regards,

Tamas



2008/4/20, Armin Burger <armin.burger at gmx.net>:
> Hello
>  Mapserver has the nice functionality for a histogram stretch of images
> using the tag PROCESSING "SCALE=x,y". I would like know to predefine TIFF
> images as a Virtual Format (VRT) and define the parameters for the linear
> stretch in the VRT file instead of the layer definition via PROCESSING
> SCALE=...
>
>  Is this possible? There is the <LUT> tag but I have not understood how to
> convert from the PROCESSING definition to the required values there. What
> would I need for example in the LUT that corresponds to
>   PROCESSING "SCALE_1=117,339"
>  for an image of type UInt16?
>
>  Thanks for any help
>
>  Armin
>  _______________________________________________
>  gdal-dev mailing list
>  gdal-dev at lists.osgeo.org
>  http://lists.osgeo.org/mailman/listinfo/gdal-dev
>


More information about the gdal-dev mailing list