= ossim-orthoigen = ossim-orthoigen is a command line application used to [wiki:orthorectification orthorectify], mosaic, and convert raster data between different formats. It provides a number of operations including subsetting, resampling, histogram matching, and reprojection of data. '''NOTE: YOU MUST HAVE A PROPER ELEVATION SETUP FOR ORTHORECTIFICATION.''' * For elevation setup, see [wiki:ossimElevationSetup] * For an OSSIM preferences example, see [wiki:ossimPreferenceFile] == Usage == {{{ ossim-orthoigen [options] ... }}} == Options == {{{ --annotate annotation keyword list --chain-template Specify an external file that contains chain information --clip-to-valid-rect When true, any requested cut rect is clipped by the valid image bounding rect to minimize null border pixels. If false, the output will correspond to the cut rect as close as possible given the product projection. This option overrides the ossim_preferences setting. If no cut options are supplied, this option is ignored. --combiner-template Specify an external file that contains combiner information --combiner-type Specify what mosaic to use, ossimImageMosiac or ossimFeatherMosaic or osimBlendMosaic ... etc --cut-bbox-en Specify the min easting, min northing, max easting, max northing --cut-bbox-ll Specify the min lat and min lon and max lat and maxlon --cut-center-ll Specify the center cut in lat lon space. Takes two argument --cut-pixel-width-height Specify cut box's width and height in pixels --cut-radius-meters Specify the cut distance in meters. A bounding box for the cut will be produced --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 --enable-entry-decoding A filename can be separated by a | and a number (NO space). Example: a.toc|0 will do entry 0 of a.toc file and on unix you might want to use a \ since the separator is a pipe sign. Example: ./a.toc\|0 will do entry 0 of a.toc. --geo Defaults to a geographic image chain with GSD = to the input. Origin of latitude ison the equator. --geo-scaled Takes a latitude as an argument for purpose of scaling. Specifies that no spec file was defined. Defaults to a scaled geographic image chain with GSD = to the input. --hist-auto-minmax uses the automatic search for the best min and max clip values. Incompatible with other histogram options. --hist-match Takes one image filename argument for target histogram to match. Incompatible with other histogram options. --hist-std-stretch Specify histogram stretch as a standard deviation from the mean as , where is 1, 2, or 3. Incompatible with other histogram options. --hist-stretch Specify in normalized percent the low clip and then the high clip value as . Incompatible with other histogram options. --input-proj Makes the view equal to the input. If more than one file then the first is taken --mask Specify the ESRI shape file with polygons to clip the image --meters Specifies an override for the meters per pixel. Takes a single value applied equally to x and y directions. --meters-xy Specifies an override for the meters-per-pixel. Takes two values --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. --resample-type Specify what resampler to use, nearest neighbor, bilinear, cubic --scale-to-8-bit Scales output to eight bits if not already. --slave-buffers number of slave tile buffers for mpi processing (default = 2) --srs specify an output reference frame/projection. Example: --srs EPSG:4326 --stdout Output the image to standard out. This will return an error if writer does not support writing to standard out. Callers should combine this with the --ossim-logfile option to ensure output image stream does not get corrupted. You must still pass an output file so the writer type can be determined like "dummy.png". --supplementary-directory or --support Specify the supplementary directory path where overviews, histograms and external geometries are located --tiling-template Specify an external file that contains tiling information --utm Defaults to a utm image chain with GSD = to the input --view-template Specify an external file that contains view information --wkt specify an output reference frame/projection that is in a wkt format. Must have the ossimgdal_plugin compiled --writer-prop Passes a name=value pair to the writer for setting it's property. Any number of these can appear on the line. --writer-template Specify an external file that contains tiling information -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. -h or --help Display this information -t or --thumbnail thumbnail size -w or --writer Specifies the output writer. Default uses output file extension to determine writer. }}} == Input Files == For orthoigen you must at a minimum specify an input and an output file. Example: {{{ ossim-orthoigen C:\input.tif D:\output.jpg }}} Users can specify multiple input files like this: {{{ ossim-orthoigen C:\input.tif C:\input2.tif C:\input3.tif D:\output.jpg }}} Alternatively, you can pass in a text file with a ".src" extension with a list of file paths separated by a newline. Example: {{{ ossim-orthoigen image.src output.ntf }}} The corresponding image.src file would be as simple as this: {{{ image0.file: C:\input1.tif image1.file: C:\input2.tif image2.file: C:\input3.tif }}} == Entry Decoding and Band Selection == orthoigen allows users to specify which entry and which bands to use in the input file(s). This is possible via the --enable-entry-decoding argument. Example: {{{ ossim-orthoigen.exe --enable-entry-decoding image.ntf|0|3,2,1 output.tif }}} This will create a product from image0 that uses bands 3, 2, and 1. Note that the band selection is optional. Example: {{{ ossim-orthoigen.exe --enable-entry-decoding image.ntf|0 output.tif }}} This will create a product from image0 that uses bands 1, 2, and 3. == Output Format == By default, the output writer type is determined by the extension of the output file. You can specify a specific writer to use via the -w argument. A list of all available writers can be found [wiki:formats here]. In addition to specifying a writer, you can also define writer specific parameters via the --writer-prop argument. Here's an example of both the -w and --writer-prop in use to create a GeoJP2 file using the Kakadu plugin. Example: {{{ ossim-orthoigen -w ossim_kakadu_jp2 --writer-prop threads=4 --writer-prop compression_quality=visually_lossless --srs EPSG:4326 N10-E024.tif N10-E024.jp2 }}} Normally orthoigen outputs a physical file but there is a way to redirect the output to the standard output stream. This is particularly useful if you want to create a composite application like a web map server. Currently the output writer is selected from the output file's extension so you must supply a dummy arg. Example: {{{ ossim-orthoigen --stdout input.ntf dummy.png }}} It is recommended that you use the log file option to avoid corrupting the image stream from any program output (see --ossim-logfile). == Output Projection == orthoigen provides users several options for defining the output projection. The options are summarized below. If none of these options are used, orthoigen will default to the projection of the input file. If multiple input files are supplied, orthoigen will use the projection of the first image in the image chain. * '''srs''': Allows users to specify a PCS or EPSG code for the output image. For example, to set the output projection to NAD83/UTM zone 12N, specify the following: {{{ ossim-orthoigen --srs EPSG:26912 }}} * '''geo''': Sets the output projection to WGS84. This is identical to "--srs EPSG:4326". Example: {{{ ossim-orthoigen --geo }}} * '''geo-scaled''': Sets the output projection to WGS84 with an additional parameter used to specify the scale center. Let's say your input projection is utm and you want the output to be geographic with the pixels size scaled on the longitude direction by the cosine of the latitude. This will give you way less distortion unless you are very close to the Equator. In this example let's say the image center latitude is 41.5 North: {{{ ossim-orthoigen --geo-scaled 41.5 --resample-type bicubic --meters 2.0 input.ntf output.tif }}} * '''wkt''': Sets the output projection using well known text (wkt). Example: {{{ ossim-orthoigen --wkt GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]] }}} * '''utm''': Reproject image to UTM. Example: {{{ ossim-orthoigen --utm }}} * '''input-proj''': Sets the output projection the input file. If multiple input files are supplied, orthoigen will use the projection of the first image in the image chain. Example: {{{ ossim-orthoigen --input-proj }}} * '''view-template''': Specify an external file that contains view information. Example: {{{ ossim-orthoigen --view-template view_template/utm_8.kwl }}} == Output Resolution == By default, orthoigen will default to the lowest resolution image found in the list of input files. Users can override this by specifying the output resolution. * '''meters''' Specify the output resolution in meters per pixel. Takes a single value applied equally to x and y directions. * '''meters-xy''' Specify the output resolution in meters per pixel. Takes a two values. The first is applied to the x axis. The second is applied to the y axis. == Output !Width/Height == Users can specify the output image dimensions on one of two ways: * '''t''' Specify the maximum width/height for the output image in pixels. Ensures correct aspect ratio is maintained with the source. Example: {{{ ossim-orthoigen --geo -t 512 image.tif image_tn.jpg }}} Creates an image in geographic projection that is at most 512 pixels on a side - ideal for thumbnail generation. * '''cut-pixel-width-height''' User defined width/height value in pixels. Example: {{{ ossim-orthoigen --geo --cut-pixel-width-height 683 332 image.tif output.jpg }}} Creates an image in geographic projection that has an arbitrary width/height specification - ideal for WMS responses. == Output Bit Depth == orthoigen allows users to specify the output bit depth. For example, suppose you have a NITF that is 11 bit and you want 8 bit out. The --scale-to-8-bit argument will force the output to 8 bits per pixel. Example: {{{ ossim-orthoigen --scale-to-8-bit input.ntf output.tif }}} == !Clipping/Subsetting == orthoigen provides several methods for defining the output image extents: * '''cut-bbox-ll''' Specify the min lat and min lon and max lat and max lon. Coordinates must be specified in geographic/WGS84 regardless of the input source. Example: {{{ ossim-orthoigen --cut-bbox-ll 39.4049 -81.9962 41.4256 -60.9536 input.tif output.tif }}} * '''cut-bbox-en''' Specify the min easting, min northing, max easting, max northing * '''cut-center-ll''' Specify the center cut in lat lon space. Must be used in conjunction with width/height. == Resampling == orthoigen provides several resampling methods via the --resample-type argument. Example: {{{ ossim-orthoigen --resample-type bicubic --meters 2.0 input.ntf output.tif }}} Here's a complete list of resampling modes: * '''nearest neighbor''' * '''bilinear''' * '''cubic''' * '''bessel''' * '''blackman''' * '''box''' * '''bspline''' * '''catrom''' * '''gaussian''' * '''hanning''' * '''hamming''' * '''hermite''' * '''lanczos''' * '''mitchell''' * '''quadratic''' * '''sinc''' == Histogram Operations == The following histogram can be applied to the output image. These options require a histogram file (*.his) exist for each of the input files (see [wiki:create_histo]). * '''hist-auto-minmax''' Automatically adjusts the histogram based on the min and max histogram values. * '''hist-match''' Automatically adjusts the histogram to match another image. * '''hist-std-stretch''' Performs a linear contrast stretch using a standard deviation from the mean (e.g. 1, 2, or 3) * '''hist-stretch''' Performs a linear contrast stretch using a user defined min/max value. == Mosaicking Options == When two or more images are supplied, orthoigen will create a mosaic. Users have the options to specify what mosaic to use via the --combiner-type argument: * '''ossimImageMosiac''' * '''ossimFeatherMosaic''' * '''ossimBlendMosaic''' == Tiling == orthoigen can be used to create tiled outputs using a tiling template. Examples: {{{ ossim-orthoigen --chain-template chain_templates/landsat_projected_321.kwl --tiling-template tiling_templates/1024x1024.kwl --thumbnail 2048 --utm /data/p44r34oossim-/l71044034_03420000725_hrf.fst output/ ossim-orthoigen --geo --tiling-template tiling_templates/orthoigen_srtm_3arc.kwl /data/ele1/DTED3arc/w100/n40.dt1 output/ }}} Here's an example of a tiling template that's used to chop up an image into 512x512 tiles. Tiling units can be in pixels, meters, or degrees. {{{ igen.tiling.tile_size: 512 512 igen.tiling.use_offset: 0.0 0.0 igen.tiling.padding: 0.0 0.0 igen.tiling.units: pixel igen.tiling.clip_to_aoi: true igen.tiling.output_file_name: %r%_%c%.jpg }}} Here's an example of a tiling template that's used to chop up an image using a shapefile: {{{ igen.tiling.tile_source: C:\co_county_sub.shp|select * from 'co_county_sub' where FID = 0 igen.tiling.padding: 500.0 500.0 igen.tiling.padding_use_mbr: true igen.tiling.units: meters igen.tiling.output_file_name: dted_eof_500m_%f%.tif }}} More tiling/chipping options can be found in the attached presentation.