wiki:img2rr

Version 17 (modified by pborissow, 14 years ago) ( diff )

--

img2rr

This command creates reduced resolution images, also known as a pyramid image structure from the input image. Reduced resolution layers are created by iteratively downsampling the full resolution image. The results are stored in a .ovr (overview) file. This structure improves the efficiency of arbitrary access to different spatial resolutions and areas of interest. The OSSIM library will automatically select the appropriate layer and area of interest for needed operations.

Usage

img2rr [options] <input_file>

Options

  --compression-quality    Compression quality varies from 0 to 100, where 100
                           is best.  Currently only for JPEG compression
  --compression-type       Compression type can be: NONE, JPEG, PACKBITS, or
                           DEFLATE
  --create-histogram       Computes a histogram.
  --create-histogram-fast  Computes a histogram in fast mode which samples
                           partial tiles.
  --create-mask            Computes a mask which applies to an image for cutting
                           off black specks around the image.
  --disable-elev           Will disable the elevation
  --disable-notify         Takes an argument. Arguments are ALL, WARN, NOTICE,
                           INFO, FATAL, DEBUG.  If you want multiple disables
                           then just do multiple --disable-notify on the command
                           line.  All argument are case insensitive.  Default is
                           all are enabled.
  --disable-plugin         Will disable the plugin loader
  --histogram-bins         Number of histogram bins.   This will override the
                           default for scalar type.  Also this will force a
                           separate pass.
  --histogram-max          Maximum histogram value to use.  This will override
                           the default for scalar type.  Also this will force a
                           separate pass.
  --histogram-min          Minimum histogram value to use.  This will override
                           the default for scalar type.  Also this will force a
                           separate pass.
  --histogram-r0           Forces create-histogram code to compute a histogram
                           using r0.  If source image has reduced resolution
                           sets built in a separate pass will be made at r0.
  --list-entries           Lists the entries within the image
  --ossim-logfile          takes a logfile as an argument.  All output messages
                           are redirected to the specified log file.  By default
                           there is no log file and all messages are enabled.
  --tile-size              Defines the tile size for the supported overview
                           handler.
  --version                Outputs version information.
  --writer-prop            Adds a property to send to the writer. format is
                           name=value
  -K                       specify individual keywords to add to the preferences
                           keyword list: name=value
  -P                       specify a preference file to load
  -T                       specify the classes to trace, ex:
                           ossimInit|ossimImage.*
                           will trace ossimInit and all ossimImage classes
  -V or --version          Display version information.
  -a or --include-fullres  Wants to include full res dataset as well as reduced
                           res sets.
  -d                       Write overview to directory specified.
  -e or --entry            Give the entry(zero based) to build an overview for.
  -h or --help             Shows help
  -o                       Write overview to file specified.  If used on a
                           multi-entry file, given "foo.ovr" you will get:
                           "foo_e0.ovr"
  -r or --rebuild          Rebuild overviews even if they are already present.
  -s                       Stop dimension for overviews.  This controls how
                           many layers will be built. If set to 64 then the
                           builder will stop when height and width for current
                           level are less than or equal to 64.  Note a default
                           can be set in the ossim preferences file, setting the
                           keyword "overview_stop_dimension".
  -t or --type             see list at bottom for valid types. (default =
                           ossim_tiff_box)

Overview Types

Valid overview types include:

  • ossim_tiff_box*
  • ossim_tiff_nearest
  • gdal_tiff_nearest
  • gdal_tiff_average
  • gdal_hfa_nearest
  • gdal_hfa_average
  • ossim_kakadu_nitf_j2k

* default

Compression Options

By default, overviews are uncompressed TIFF files. However, there are several options available to create compressed overviews.

  • JPEG compression With ossim_tiff_box and ossim_tiff_nearest, you can create JPEG compressed overviews by setting "--compression-type JPEG". You can also specify the compression quality using the "--compression-quality" argument. Example:
    ossim-img2rr --compression-type JPEG --compression-quality 90 image.tif
    
    When using JPEG compression, null areas are replaced with black pixels (RGB 0,0,0). To retain the null pixels, you must create a mask file. Example:
    ossim-img2rr --compression-type JPEG --compression-quality 75 --create-mask image.tif
    
  • JPEG 2000 compression With ossim_kakadu_nitf_j2k, users have the option to create JPEG 2000 compressed NITF files. This option requires the Kakadu Plugin.
    ossim-img2rr -t ossim_kakadu_nitf_j2k --writer-prop threads=4 --writer-prop compression_quality=visually_lossless image.tif
    
  • ERDAS Imagine compression With gdal_hfa_nearest and gdal_hfa_average, users have the option to create overviews in ERDAS Imagine format. This option requires the GDAL Plugin.
    ossim-img2rr -t gdal_hfa_nearest image.tif
    

Stop Dimension

Users can control how many layers will be create by specifying a stop dimension. The stop dimension is set using the -s argument. Examples:

Build overviews, specifying to stop when both width and height are less than or equal to 64:

ossim-img2rr -s 64 <your-file>

Build overviews, specifying to stop when both width and height are less than or equal to 1:

ossim-img2rr -s 1 <your-file>

Note a default can be set in the ossim preferences file, setting the keyword "overview_stop_dimension".

Histogram Operations

img2rr provides an option to create a histogram when generating overviews.

  • create-histogram Computes a histogram.
  • create-histogram-fast Fast histogram computation

When creating histograms, users have the following histogram options:

  • histogram-bins Number of histogram bins.
  • histogram-max Maximum histogram value to use.
  • histogram-min Minimum histogram value to use.

Examples

ossim-img2rr -t ossim_kakadu_nitf_j2k --create-histogram-fast --histogram-r0 --entry 2 data\cadrg\cdrgxGNCJNCN_10\RPF\a.toc

Build overviews, default type = ossim_tiff_box:

ossim-img2rr <your-file>

Build overviews forcing a rebuild if already present with -r option:

ossim-img2rr -r <your-file>

Build overviews specifying the output file with -o option:

ossim-img2rr <your-file> -o foo.ovr

Build overviews specifying the output directory with -d option:

ossim-img2rr -d /tmp <your-file>

Build overviews specifying the output directory with -d option and the output file with -o option. Good for multi entry:

ossim-img2rr -d /tmp <a.toc> -o rpf-1

Build overviews specifying the type:

ossim-img2rr -t ossim_tiff_box <your-file>

Build overviews specifying the type:

ossim-img2rr -t ossim_tiff_nearest <your-file>

Build overviews specifying the type, nitf with j2k compressed blocks (requires Kakadu plugin):

ossim-img2rr -t ossim_kakadu_nitf_j2k <your-file>

Build overviews copy r0 (full res layer) (ossim_tiff types only)

ossim-img2rr -a <your-file>

http://trac.osgeo.org/ossim/browser/trunk/ossim/etc/templates/ossim_preferences_template
http://trac.osgeo.org/ossim/wiki/ossimPreferenceFile
http://trac.osgeo.org/ossim/wiki/UserDocs

Note: See TracWiki for help on using the wiki.