ENVIGCPSet::ApplyOffset
The ApplyOffset function method subtracts a designated pixel offset from all of the GCPs in an ENVIGCPSet object. Use this method when applying GCPs from a full input image to a spatially subsetted image with the RPCOrthorectification task.
If you set the OUTPUT_SUBSET property on the RPCOrthorectification task, you do not need to use the ApplyOffset method.
Example
The following example shows the use of ApplyOffset with a spatially subsetted image.
; Start the application
e = ENVI()
; Open an image file
ImageFile = Dialog_Pickfile(TITLE='Select an input image')
Raster = e.OpenRaster(ImageFile)
; Create a spatial subset of the image file
RasterSubset = ENVISubsetRaster(Raster, SUB_RECT=[200, 300, 400, 400])
; Open a DEM
DEMFile = Dialog_Pickfile(TITLE='Select a DEM file')
DEM = e.OpenRaster(DEMFile)
; Open a ground control point (GCP) file
GCPFile = Dialog_Pickfile($,
TITLE='Select a GCP shapefile or ENVI .pts file')
GCPs = ENVIGCPSet(GCPFile)
; Adjust the GCPs for the spatial subset
NewGCPs = GCPs.ApplyOffset(200, 300)
; Get the RPC orthorectification task
Task = ENVITask('RPCOrthorectification')
; Define parameters for the task
Task.Input_Raster = RasterSubset
Task.DEM_Raster = DEM
Task.Input_GCP = NewGCPs
Task.Output_Raster_URI = e.GetTemporaryFilename()
; Run the task
Task.Execute, ERROR=error
RasterSubset.Close
Syntax
Result = ENVIGCPSet.ApplyOffset(xOff, yOff [, ERROR=variable])
Return Value
This method returns a reference to a new ENVIGCPSet object.
Arguments
xOff
The subset x1 value
yOff
The subset y1 value
Keywords
ERROR
Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''
). If an error occurs and the routine is a function, then the function result will be undefined.
When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.
See Manage Errors for more information on error handling in ENVI programming.
Version History
ENVI 5.1 |
Introduced |
API Version
4.2