ExtractROI

Extract a ROI defined by the user.

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

Input Image -in image Mandatory
Image to be processed.

Output Image -out image [dtype] Mandatory
Region of interest from the input image

Extraction mode -mode [standard|fit|extent|radius] Default value: standard

  • 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.
  • 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.
  • Radius
    In radius mode, the ROI is defined by a point and a radius. The unit of those two parameters can be chosen independently.

Fit options

Reference image -mode.fit.im image
Reference image to define the ROI

Reference vector -mode.fit.vect vectorfile
The extent of the input vector file is computed and then gives a region of interest that will be extracted.

Extent options

X coordinate of the Upper left corner -mode.extent.ulx float Default value: 0
X coordinate of upper left corner point.

Y coordinate of Upper Left corner point -mode.extent.uly float Default value: 0
Y coordinate of upper left corner point.

X coordinate of Lower Right corner point -mode.extent.lrx float Default value: 0
X coordinate of lower right corner point.

Y coordinate of Lower Right corner point -mode.extent.lry float Default value: 0
Y coordinate of lower right corner point.

Unit -mode.extent.unit [pxl|phy|lonlat] Default value: pxl

  • 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 options

Radius -mode.radius.r float Default value: 0
This is the radius parameter of the radius mode.

Radius unit -mode.radius.unitr [pxl|phy] Default value: pxl

  • 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 -mode.radius.cx float Default value: 0
This is the center coordinate of the radius mode, it will be either an ordinate or a latitude.

Y coordinate of the center -mode.radius.cy float Default value: 0

Center unit -mode.radius.unitc [pxl|phy|lonlat] Default value: pxl

  • 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 -startx int Default value: 0
ROI start x position.

Start Y -starty int Default value: 0
ROI start y position.

Size X -sizex int Default value: 0
size along x in pixels.

Size Y -sizey int Default value: 0
size along y in pixels.

Output Image channels -cl string1 string2...
Channels to write in the output image.

Elevation management

This group of parameters allows managing elevation values.

DEM directory -elev.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. Input DEM tiles should be in a raster format supported by GDAL.

Geoid File -elev.geoid filename [dtype]
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 (egm96.grd and egm96.grd.hdr at https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/tree/master/Data/Input/DEM).

Default elevation -elev.default float Default value: 0
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) -ram int Default value: 256
Available memory for processing (in MB).

Examples

From the command-line:

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

From Python:

import otbApplication

app = otbApplication.Registry.CreateApplication("ExtractROI")

app.SetParameterString("in", "VegetationIndex.hd")
app.SetParameterString("mode","extent")
app.SetParameterFloat("mode.extent.ulx", 40)
app.SetParameterFloat("mode.extent.uly", 40)
app.SetParameterFloat("mode.extent.lrx", 150)
app.SetParameterFloat("mode.extent.lry", 150)
app.SetParameterString("out", "ExtractROI.tif")

app.ExecuteAndWriteOutput()