ExtractROI - Extract ROI

Extract a ROI defined by the user.

Detailed description

This application extracts a Region Of Interest with user parameters. There are four mode of extraction. The standard mode allows the user to enter one point (upper left corner of the region to extract) and a size. The extent mode needs two points (upper left corner and lower right) and the radius mode need the center of the region and the radius : it will extract the rectangle containing the circle defined and limited by the image dimension. The fit mode needs a reference image or vector and the dimension of the extracted region will be the same as the extent of the reference. Different units are available such as pixel, image physical space or longitude and latitude.

Parameters

This section describes in details the parameters available for this application. Table [1] presents a summary of these parameters and the parameters keys to be used in command-line and programming languages. Application key is ExtractROI .

[1]Table: Parameters table for Extract ROI.
Parameter Key Parameter Name Parameter Type
in Input Image Input image
out Output Image Output image
mode Extraction mode Choices
mode standard Standard Choice
mode fit Fit Choice
mode extent Extent Choice
mode radius Radius Choice
mode.fit.im Reference image Input image
mode.fit.vect Reference vector Input vector data
mode.extent.ulx X coordinate of the Upper left corner Float
mode.extent.uly Y coordinate of Upper Left corner point. Float
mode.extent.lrx X coordinate of Lower Right corner point. Float
mode.extent.lry Y coordinate of Lower Right corner point. Float
mode.extent.unit Unit Choices
mode.extent.unit pxl Pixel Choice
mode.extent.unit phy Image physical space Choice
mode.extent.unit lonlat Longitude and latitude Choice
mode.radius.r Radius Float
mode.radius.unitr Radius unit Choices
mode.radius.unitr pxl Pixel Choice
mode.radius.unitr phy Image physical space Choice
mode.radius.cx X coordinate of the center Float
mode.radius.cy Y coordinate of the center Float
mode.radius.unitc Center unit Choices
mode.radius.unitc pxl Pixel Choice
mode.radius.unitc phy Image physical space Choice
mode.radius.unitc lonlat Lon/Lat Choice
startx Start X Int
starty Start Y Int
sizex Size X Int
sizey Size Y Int
cl Output Image channels List
elev Elevation management Group
elev.dem DEM directory Directory
elev.geoid Geoid File Input File name
elev.default Default elevation Float
ram Available RAM (Mb) Int
inxml Load otb application from xml file XML input parameters file
outxml Save otb application to xml file XML output parameters file

Input Image: Image to be processed.

Output Image: Region of interest from the input image.

Extraction mode Available choices are:

  • Standard: In standard mode extraction is done with 2 parameters : the upper left corner and the size of the region, decomposed in X and Y coordinates.
  • Fit: In fit mode, extract is made from a reference : image or vector dataset.
  • Reference image: Reference image to define the ROI.
  • Reference vector: The extent of the input vector file is computed and then gives a region of interest that will be extracted.
  • Extent: In extent mode, the ROI is defined by two points, the upper left corner and the lower right corner, decomposed in 2 coordinates : X and Y. The unit for those coordinates can be set.
  • X coordinate of the Upper left corner: X coordinate of upper left corner point.
  • Y coordinate of Upper Left corner point.: Y coordinate of upper left corner point.
  • X coordinate of Lower Right corner point.: X coordinate of lower right corner point.
  • Y coordinate of Lower Right corner point.: Y coordinate of lower right corner point.
  • Unit Available choices are:
  • Pixel: The unit for the parameters coordinates will be the pixel, meaning the index of the two points.
  • Image physical space: The unit for the parameters coordinates will be the physical measure of the image.
  • Longitude and latitude: The unit for the parameters coordinates will be the longitude and the latitude.
  • Radius: In radius mode, the ROI is defined by a point and a radius. The unit of those two parameters can be chosen independently.
  • Radius: This is the radius parameter of the radius mode.
  • Radius unit Available choices are:
  • Pixel: The unit of the radius will be the pixel.
  • Image physical space: The unit of the radius will be the physical measure of the image.
  • X coordinate of the center: This is the center coordinate of the radius mode, it will be either an ordinate or a latitude.
  • Y coordinate of the center
  • Center unit Available choices are:
  • Pixel: The unit for the center coordinates will be the pixel.
  • Image physical space: The unit for the center coordinates will be the physical measure of the image.
  • Lon/Lat: The unit for the center coordinates will be the longitude and the latitude.

Start X: ROI start x position.

Start Y: ROI start y position.

Size X: size along x in pixels.

Size Y: size along y in pixels.

Output Image channels: Channels to write in the output image.

[Elevation management]: This group of parameters allows managing elevation values. Supported formats are SRTM, DTED or any geotiff. DownloadSRTMTiles application could be a useful tool to list/download tiles related to a product.

  • DEM directory: This parameter allows selecting a directory containing Digital Elevation Model files. Note that this directory should contain only DEM files. Unexpected behaviour might occurs if other images are found in this directory.
  • Geoid File: Use a geoid grid to get the height above the ellipsoid in case there is no DEM available, no coverage for some points or pixels with no_data in the DEM tiles. A version of the geoid can be found on the OTB website (http://hg.orfeo-toolbox.org/OTB-Data/raw-file/404aa6e4b3e0/Input/DEM/egm96.grd).
  • Default elevation: This parameter allows setting the default height above ellipsoid when there is no DEM available, no coverage for some points or pixels with no_data in the DEM tiles, and no geoid file has been set. This is also used by some application as an average elevation value.

Available RAM (Mb): Available memory for processing (in MB).

Load otb application from xml file: Load otb application from xml file.

Save otb application to xml file: Save otb application to xml file.

Example

To run this example in command-line, use the following:

otbcli_ExtractROI -in VegetationIndex.hd -mode extent -mode.extent.ulx 40 -mode.extent.uly 40 -mode.extent.lrx 150 -mode.extent.lry 150 -out ExtractROI.tif

To run this example from Python, use the following code snippet:

#!/usr/bin/python

# Import the otb applications package
import otbApplication

# The following line creates an instance of the ExtractROI application
ExtractROI = otbApplication.Registry.CreateApplication("ExtractROI")

# The following lines set all the application parameters:
ExtractROI.SetParameterString("in", "VegetationIndex.hd")

ExtractROI.SetParameterString("mode","extent")

ExtractROI.SetParameterFloat("mode.extent.ulx", 40)

ExtractROI.SetParameterFloat("mode.extent.uly", 40)

ExtractROI.SetParameterFloat("mode.extent.lrx", 150)

ExtractROI.SetParameterFloat("mode.extent.lry", 150)

ExtractROI.SetParameterString("out", "ExtractROI.tif")

# The following line execute the application
ExtractROI.ExecuteAndWriteOutput()

Limitations

None

Authors

This application has been written by OTB-Team.