Matching two flight lines by applying Boresight corrections

This page summarises how to match two flight lines together if they do not line up, by using boresight corrections. For information about how the script works go here? (When it's been written :) )


The IDL script will take 2 images and utilise either a feature match or area-based match to generate tie-points, or will use tie-points given in a separate file. When IDL is started, at the prompt type:

envi, /restore_base_save_files

This will setup the ENVI functionality. Then (if the script is not in your current directory include the path to the file) type:


to compile the script. To run the script type the following command, replacing the $words with their respective values:

getboresight, '$basefilename' ,'$warpfilename','$matchtype','$height','$HORIZONTAL','$headdir','$outputdirectory'


  • $basefilename is the master/base file (tif image you want to match to)
  • $warpfilename is the slave/warp file (tif you want to match to the basefile)
  • $matchtype is either 'feature', 'area' or '<filename>' where filename is GCP file in ENVI format
  • $height is the height of the aircraft when the warpimage was acquired
  • $HORIZONTAL is either 'horiz' or 'nothoriz' depending on the heading of the aircraft. Suggest 'horiz' if heading is in ranges 355-005, 085-095, 175-185 or 265-275.
  • $headdir depends on heading direction: '+' if heading 0->179 else '-'
  • $outputdirectory is the name of a directory to spit out jpgs and txt files

The pitch, roll and yaw angles to use are reported at the end of the terminal output. The quality of these can be checked first by viewing the produced image. If the blue-green tiepoints appear to have random offsets or there are very few of them then the quality may not be very good. Reprocess the warp image using the new boresight adjustment values and view it together with the base image to determine its quality. Further iterations may be required.

Important Notes

The warp and base images used should be as straight as possible, no wobbles or bends in the data. Only short parts of the flight lines are required, usually 2000 lines will suffice. Prior to running the script you should view the 2 images to check they overlap with each other. Use azexhdf -h <lev1filename> to get the height and heading of the flight line

This method does not always produce suitable results and the following may help if the results are not good:

  • try changing the matching type if the number of tie points attained was small or bad quality
  • you may have to tie point manually in ENVI - slow and more effort but results usually good (if your tie points are)
  • check you are using the correct height for the part of the line you are matching against

More automated approach

There are another 2 scripts which can be used for a more automated approach but there are some known issues with these.

  • can be used as a more simple way to run the IDL script from a bash terminal. It assumes you also have the script in the same directory and is run as: $warplev1file $basefilename $warpfilename '$matchtype' '$outputdirectory' replacing the $words
  • can be used to loop through an image file in a project directory but runs with certain constraints and assumptions. In general its probably best not to use this until certain bugs are fixed. It (should) iterate 10 times or until convergence in the PRH values are attained.
    • filename assumption: All warp/base file names and lev1 names have similar prefix. EG If warpfile script is named then warplev1 file must be h304011b_gpt*.hdf, warpfile must be h304013b_gpt*.tif, basefile must be e304013b_gpt*.tif where * is the same GPT value as in the warpfile script.
    • example warp/base file scripts are included in the svn checkout
    • also requires and
  • capable of running through an entire project to get values for each pair of flight lines
Last modified 9 years ago Last modified on Apr 30, 2009 4:49:07 PM