Re: Batch ENVI Resize Data (Spatial/Spectral) [message #71195] |
Mon, 07 June 2010 07:52 |
titan
Messages: 59 Registered: March 2006
|
Member |
|
|
On Jun 4, 8:31 pm, Chris Jengo <cje...@gmail.com> wrote:
> To subset using map coordinates, you first need to convert your map
> coordinates into pixel coordinates for the image of interest. Create
> an array containing the lat/lon coordinates for a box containing Italy
> (or whatever map subset you want), and push these through
> ENVI_CONVERT_FILE_COORDINATES to retrieve their respective pixel
> coordinates. Then construct your DIMS vector to RESIZE_DOIT by
> finding the min and max boundaries of the returned vertices (in pixel
> coordinates) that form a polygon.
Maybe I found another way:
;; Matrix test
asc_proj=ENVI_GET_PROJECTION(FID=asc_r_fid,PIXEL_SIZE=asc_ps )
italy=asc_img[715:768,72:123]
italy_r_fact=[0.041397525,0.040697525]
output_pixel_size=[1000.000, 1000.000]
mc_italy_proj=[0.0D,0.0D,589086.84,5564990.5]
output_italy_proj = ENVI_MAP_INFO_CREATE(PROJ=asc_proj,
PS=output_pixel_size, MC=mc_italy_proj)
;; Enter the subset of Italy
ENVI_ENTER_DATA,
italy,MAP_INFO=output_italy_proj,PIXEL_SIZE=output_pixel_siz e,$
BNAMES='Italy_file',R_FID=italy_r_fid
ENVI_FILE_QUERY,italy_r_fid,DIMS=italy_res_data_dims
; Resize_doit it in order to see it bigger
ENVI_DOIT, 'RESIZE_DOIT', FID=italy_r_fid, DIMS=italy_res_data_dims,
POS=0,$
INTERP=0, RFACT=italy_r_fact,
OUT_BNAME='Italy',/IN_MEMORY, R_FID=italy_resize_r_fid
ENVI_FILE_QUERY,italy_resize_r_fid,DIMS=italy_resize_dims,
NS=italy_resize_ns, NL=italy_resize_nl, NB=italy_resize_nb
;;----------------------------
so the trick was in the RFACT value!! setting the proper value I can
start from the 54x52 image and then I get the 1304x1278 image
It seems correct to me also comparing the result with the file that I
get manually..
What do you think?
PS In any case thanks for your support!!
|
|
|
Re: Batch ENVI Resize Data (Spatial/Spectral) [message #71219 is a reply to message #71195] |
Fri, 04 June 2010 11:31  |
Chris Jengo
Messages: 13 Registered: July 1999
|
Junior Member |
|
|
To subset using map coordinates, you first need to convert your map
coordinates into pixel coordinates for the image of interest. Create
an array containing the lat/lon coordinates for a box containing Italy
(or whatever map subset you want), and push these through
ENVI_CONVERT_FILE_COORDINATES to retrieve their respective pixel
coordinates. Then construct your DIMS vector to RESIZE_DOIT by
finding the min and max boundaries of the returned vertices (in pixel
coordinates) that form a polygon.
|
|
|
Re: Batch ENVI Resize Data (Spatial/Spectral) [message #71226 is a reply to message #71219] |
Fri, 04 June 2010 08:35  |
titan
Messages: 59 Registered: March 2006
|
Member |
|
|
Ah ok..now I understand but It seems that it doesn't work like the tab
does
this is my code:
;; OPEN THE BIGGER IMAGE
ENVI_OPEN_FILE, AMSRE_asc_fname, R_FID=amsre_asc_r_fid, /
NO_INTERACTIVE_QUERY,/NO_REALIZE
ENVI_FILE_QUERY,amsre_asc_r_fid, DIMS=amsre_asc_dims, NS=amsre_asc_ns,
NL=amsre_asc_nl, NB=amsre_asc_nb
AMSRE_asc_img=ENVI_GET_DATA(FID=amsre_asc_r_fid,DIMS=amsre_a sc_dims,
POS=0)
AMSRE_asc_map_info=ENVI_GET_MAP_INFO(FID=amsre_asc_r_fid)
AMSRE_asc_proj=ENVI_GET_PROJECTION(FID=amsre_asc_r_fid,PIXEL _SIZE=amsre_asc_ps)
output_pixel_size=[1000.000, 1000.000];
I want to resize the image where there is Italy; I did a first test
using matrix inserting the sample and lines values obtained using the
RESIZE tab function but the result is not correct because I find an
image of 54x52x1 while using the tab resize function the file that I
get is 1304x1278
;;--------- Test using matrix: -----------------
AMSRE_italy=AMSRE_asc_img[715:768,72:123]
mc_italy_proj=[0.0D,0.0D,589086.84,5564990.5]
output_italy_proj = ENVI_MAP_INFO_CREATE(PROJ=AMSRE_asc_proj,
PS=output_pixel_size, MC=mc_italy_proj)
ENVI_ENTER_DATA,
AMSRE_italy,MAP_INFO=output_italy_proj,PIXEL_SIZE=output_pix el_size,$
BNAMES='AMSRE_Italy',R_FID=amsre_italy_r_fid
;;-------------------------------------------
italia_dims=LONG([-1,0,1303,0,1277])
italy_r_fact=[1.0,1.0]
ENVI_DOIT, 'RESIZE_DOIT', FID=amsre_asc_r_fid, DIMS=italia_dims,
POS=0,$
INTERP=0, RFACT=italy_r_fact, /IN_MEMORY,
R_FID=italy_resize_r_fid
Using the RESIZE DOIT how can I tell ENVI to take only the part that I
need obtaining a file of 1304x1278??
I hope that I'm clear..
thank you
|
|
|
Re: Batch ENVI Resize Data (Spatial/Spectral) [message #71229 is a reply to message #71226] |
Fri, 04 June 2010 07:34  |
Chris Jengo
Messages: 13 Registered: July 1999
|
Junior Member |
|
|
RESIZE_DOIT is the name of the procedure to look up in the ENVI help
system. To call ENVI "DOIT" routines, you actually call the ENVI_DOIT
procedure with the routine name (RESIZE_DOIT in this case) as an
argument. The ENVI_DOIT procedure makes sure all the necessary
routines are compiled, making the old-school calls to ENVI_CHECK_SAVE
prior to running the DOIT routines unnecessary.
|
|
|
Re: Batch ENVI Resize Data (Spatial/Spectral) [message #71231 is a reply to message #71229] |
Fri, 04 June 2010 07:21  |
titan
Messages: 59 Registered: March 2006
|
Member |
|
|
On Jun 4, 3:48 pm, Chris Jengo <cje...@gmail.com> wrote:
> RESIZE_DOIT (ENVI_DOIT, 'RESIZE_DOIT', ...) will do what you're
> looking for.
could you plese explain it better??
do I have to apply twice the 'RESIZE_DOIT' routine??
|
|
|
|