X

Help Articles are product support tips and information straight from the NV5 Geospatial Technical Support team developed to help you use our products to their fullest potential.



3790 Rate this article:
No rating

How to 'unrotate' an image programmatically

This Help Article discusses how to 'unrotate' an image programmatically within ENVI. This applies when you are dealing with an image that has an arbitrary map rotation, resulting in north not being "up" in a visualization. This is a common occurence with data from sensors like ASTER. "Unrotating" the image ensures that north is always up.

ENVI's ROTATE_DOIT routine is based on IDL's ROTATE function and can only rotate an image by increments of 90 degrees. In some cases, it is desireable to 'unrotate' an image by an arbitrary amount so that the image is oriented north up. When this is performed in ENVI's Rotate/Flip Data tool, a separate code path is taken that essentially reprojects the data. To perform this programmatically, you have a couple of options. You can save your data to an IDL variable and use IDL's ROT function to rotate the data an arbitrary amount or you can use ENVI's ENVI_CONVERT_FILE_MAP_PROJECTION routine which will automatically orient the data north up via reprojection. ENVI_CONVERT_FILE_MAP_PROJECTION will allow the input projection to also be used as the output projection so that the only change will be a rotation to north. This is a quick and easy way to programmatically rotate ASTER images to a north up orientation. If you instead wish to rotate an image by an arbitrary amount that is not north up, IDL's ROT function should be used instead.

The following piece of code is an example of how to use ENVI's routine to unrotate a user-selected image. In this example, a rigorous warp method is used which can take significantly longer to process. You can select to use another warp method such as triangulation to reduce processing time.

pro example_envi_convert_file_map_projection
  
 ; Select the input file
	envi_select, fid=fid, pos=pos, dims=dims
	if (fid[0] eq -1) then return
  ;
 ; Setup the projection which is the same as the input projection
   	out_name = 'test.img'
   	o_proj = envi_get_projection (fid=fid, pixel_size=o_pixel_size)
   ;
 ; Call the doit
    	envi_convert_file_map_projection, fid=fid, $
    	pos=pos, dims=dims, o_proj=o_proj, $
    	o_pixel_size=o_pixel_size,  $
    	out_name=out_name, warp_method=3, $
    	resampling=0, background=0
  ;
end
Review on 12/31/2013 MM

Please login or register to post comments.
Featured

End-of-Life Policy Enforcement for ENVI 5.3 / IDL 8.5 and Earlier Versions

5/6/2024

April 1, 2024 Dear ENVI/IDL Customer,  We are reaching out to notify you of our supported... more »

How to Upgrade licenses to ENVI 6.x / IDL 9.x

12/5/2023

What is the new Upgrade function? Starting with ENVI 6.0 and IDL 9.0, we have implemented an... more »

What to do if the 'License Administrator - License Server' for the Next-Generation License Server does not start?

6/13/2023

Background: With the release of ENVI 5.7 & IDL 8.9 and the corresponding Next-Generation licensing... more »

Next-Generation Licensing FAQ

4/28/2023

  NV5 Geospatial has adopted a new licensing technology for all future releases of our ENVI, IDL... more »

The IDL Virtual Machine

6/6/2013

What is the IDL Virtual Machine? An IDL Virtual Machine is a runtime version of IDL that can... more »