ENVI_RIGOROUS_ORTHO_DOIT
This procedure automates the Rigorous Orthorectification workflow for programmers. You must have the ENVI Photogrammetry Module licensed and installed in order to use this procedure.
Syntax
ENVI_DOIT, 'ENVI_RIGOROUS_ORTHO_DOIT' [, /AUTO_COLOR], DEM_FID=file IDs, DEM_POS=array, FID=file IDs [, FILETYPE=string] [, GCPS=array], OUT_NAME=string, PIXEL_SIZE=variable, R_FID=variable [, TIE_POINTS=array]
Keywords
AUTO_COLOR
Set this keyword to perform automatic color and contrast adjustment in the output mosaic. See Step 3 in Selecting Output Parameters.
DEM_FID
Set this keyword to an array of one or more file IDs representing digital elevation model (DEM) files. A file ID is a long-integer scalar with a value greater than 0. An invalid FID has a value of -1. The FID is provided as a named variable by one of several ENVI routines used to open or select an input file.
DEM_POS
Use this keyword to specify an array of band positions for the input DEM files, indicating the band numbers to use. DEM_POS is an array of long integers, ranging from 0 to the number of bands minus 1. Specify bands starting with zero (Band 1=0, Band 2=1, etc.). DEM_POS must consist of the same number of array elements as DEM_FID.
FID
Set this keyword to an array of one or more file IDs representing the input images used for orthorectification. The file ID (FID) is a long-integer scalar with a value greater than 0. An invalid FID has a value of -1. The FID is provided as a named variable by one of several ENVI routines used to open or select an input file.
The order of file IDs in the FID array determines the image stack order (see Change the Image Stack Order and Set the Image Order). For example, if you want FID3 on top, FID1 in the middle, and FID2 on the bottom of the image stack for the output mosaic, set FID as follows: FID= [fid3, fid1, fid2].
FILETYPE
Set this keyword to an ‘ENVI’ or ‘GeoTiff’ string to indicate the output file format.
GCPS
Set this keyword to a string scalar with the filename of a single ENVI Orthorectification GCP file, or to a string array with the filenames of multiple GCP files.
OUT_NAME
Use this keyword to specify a string with the output filename for the resulting data.
PIXEL_SIZE
Use this keyword to specify the square pixel size. PIXEL_SIZE is a single, double-precision variable that specifies the output square pixel size in meters.
R_FID
Set this keyword to a named variable containing the file ID to access the processed data. Specifying this keyword saves you the step of opening the new file from disk.
TIE_POINTS
Set this keyword to a string scalar with the filename for a single ENVI Orthorectification tie points file, or to a string array with the filenames of multiple tie points files.
Example
This example orthorectifies two QuickBird scenes of Phoenix, Arizona, USA, which are available on the ENVI Resource DVD. It demonstrates how to open the imagery, DEM, GCP file, and tie points file. The output initially is in a UTM WGS-84 projection, but it will be reprojected into a geographic coordinate system (latitude/longitude).
Prepare Input Data
You will copy the input data for this project to a local directory.
- Create a new, writeable directory called workdata at the root level of your C: drive (C:\workdata).
- On the ENVI Resource DVD, navigate to the rigorous_ortho directory.
- Copy the file phoenix_DEM_subset.tif to workdata. This is a DEM of the Phoenix area, subsetted to the area encompassing the imagery.
- On the ENVI Resource DVD, navigate to the rigorous_ortho\005606990010_01_P008_MUL directory. Copy all of the files in this directory into your workdata directory. These files comprise the QuickBird imagery of Phoenix from 11 July 2005.
- On the ENVI Resource DVD, navigate to the rigorous_ortho\005606990010_01_P011_MUL directory. Copy all of the files in this directory into your workdata directory. These files comprise the QuickBird imagery of Phoenix from 09 October 2005.
- Using a text editor such as Notepad, copy the following GCP content into a new file called phx_GCPs.pts, and place it in your workdata directory.
1 -112.004007 33.417396 311.083000 3569.000000 479.0000001 -112.094899 33.385167 309.603000 245.000000 1861.0000001 -112.038770 33.388203 316.788000 2263.000000 1788.0000001 -112.074479 33.413951 296.985000 910.000000 621.0000001 -111.978822 33.380607 336.632000 4521.000000 2143.0000001 -111.930535 33.402122 327.582000 6332.000000 1181.0000000 -111.894365 33.390883 333.140000 1279.000000 1631.0000000 -111.900306 33.419145 329.810000 1058.000000 385.000000
Note: You may be prompted, “You are about to save the document in a Text-Only format, which will remove all formatting. Are you sure you want to do this?” Click Yes.
- Copy the following tie point information into a new file called phx_TIEs.pts, and place it in your workdata directory.
1 0 6737.000000 511.750000 363.750000 480.000000 1 0 6860.250000 1997.750000 489.750000 1928.000000 1 0 6835.500000 3174.000000 471.750000 3073.500000
Run the Program
Copy the following code into a new IDL file named ortho_doit_example.pro, and save it to your IDL working directory. Compile and run the program in ENVI Classic+IDL (available from the Windows Start menu > Programs > ENVI xx > Tools.
PRO ORTHO_DOIT_EXAMPLE
COMPILE_OPT IDL2
pixel_size = 15.0d
filetype = 'GeoTiff'
autocolor = 0
filename1 = 'c:\workdata\Ortho_Output.tif'
inputimage1 = 'c:\workdata\05JUL11182931-M1BS-005606990010_01_P008.TIF'
inputimage2 = 'c:\workdata\05OCT09183407-M1BS-005606990010_01_P011.TIF'
inputdem = 'c:\workdata\phoenix_DEM_subset.tif'
inputgcps = 'c:\workdata\phx_GCPs.pts'
inputties= 'c:\workdata\phx_TIEs.pts'
ENVI_OPEN_DATA_FILE, inputimage1, /TIFF, R_FID = fid1
sensor_type = ENVI_SENSOR_TYPE('quickbird')
ENVI_CHANGE_HEAD, fid1, SENSOR_TYPE = sensor_type
ENVI_OPEN_DATA_FILE, inputimage2, /TIFF, R_FID=fid2
sensor_type = ENVI_SENSOR_TYPE('quickbird')
ENVI_CHANGE_HEAD, fid2, SENSOR_TYPE = sensor_type
ENVI_OPEN_FILE, inputdem, R_FID=dfid
ENVI_DOIT, 'ENVI_RIGOROUS_ORTHO_DOIT', $
R_FID = ofid, $
FID = [fid1,fid2], $
DEM_FID = dfid, $
DEM_POS = 1, $
GCPS = inputgcps, $
TIE_POINTS=inputties, $
PIXEL_SIZE = pixel_size, $
FILETYPE = filetype, $
AUTOCOLOR = autocolor, $
OUT_NAME = filename1
ENVI_OPEN_DATA_FILE, filename1, R_FID = ofid, /TIFF
filename2 = 'c:\workdata\Ortho_Output_Reprojected'
ENVI_FILE_QUERY, ofid, DIMS = dims, NB = nb, FNAME = fname
POS = lindgen(nb)
o_proj=ENVI_PROJ_CREATE(/GEOGRAPHIC)
ENVI_CONVERT_FILE_MAP_PROJECTION, $
R_FID = rfid, $
FID = ofid, $
POS = pos, $
DIMS = dims, $
O_PROJ = o_proj, $
RESAMPLING = 0, $
WARP_METHOD = 2, $
OUT_NAME = filename2
END
The process will take several minutes to complete. Output will consist of the following files:
- Ortho_Output.tif: orthorectified base image in a UTM WGS-84 projection
- Ortho_Output_project_summary.txt: summary file listing data used in the project
- Ortho_Output_Reprojected: Orthorectified image in ENVI format, reprojected to a geographic coordinate system
- Ortho_Output_Reprojected.hdr: Header file for above
The resulting images are added to the ENVI Available Bands List. To validate the results, open the two images (Ortho_Output.tif and Ortho_Output_Reprojected) in separate display groups. From one of the Display group menu bars, select Tools > Link > Geographic Link. In the Geographic Link dialog, use the toggle buttons to turn both images On. Select a location in either image to move to the corresponding location in the other image.
API Version
3.6