提取ROI¶
提取用户定义的ROI。
描述¶
该应用程序使用用户参数提取感兴趣的区域。有四种提取模式。标准模式允许用户输入一点(要提取的区域的左上角)和大小。范围模式需要两个点(左上角和右下角),半径模式需要区域的中心和半径:它将提取包含由图像维度定义和限制的圆的矩形。拟合模式需要参考图像或矢量,并且提取区域的尺寸将与参考范围相同。可以使用不同的单位,如像素、图像物理空间或经度和纬度。
参数¶
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.
适配选项¶
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.
范围选项¶
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 -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.
高程管理¶
这组参数允许管理高程值。
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).
实例¶
从命令行执行以下操作:
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
来自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()