I was trying to classify the same image at different resolutions. Thus, I have to resample the image use envi_doit, 'RESIZE_DOIT' fisrst.
The problem was how to trandfer thetraining data from one image to another, and this could be easily realized in ENVI using reconcile rois via map, and I need to perform it in envi batch mode, and I found the answer at the site:
http://www.exelisvis.com/Support/Foru...
But I got some problem with ‘envi_convert_file_coordinates’procedure, when I set the resize factor:[xfac=1,yfac=1], the pixel in the converted new roi doesn’tmatch the original one.
Here are some source code from my project.
; Delete any unwanted ROIs
envi_delete_rois, roi_ids
envi_restore_rois, 'image_rois.roi'
roi_ids = envi_get_roi_ids(fid=fid, $
roi_colors=roi_colors, $
roi_names=class_names)
;get all the ROI addresses from the first image
re_roi_id = lonarr(n_elements(roi_ids))
re_roi_name = ['target','bkground']
fori=0, n_elements(roi_ids)-1 do begin
roi_pxAdd = envi_get_roi(roi_ids[i], $
roi_color=roi_colors, $
roi_name=roi_names)
envi_convert_file_coordinates, fid, roi_pxAdd/ns, roi_pxAdd mod ns,XMap, YMap, /TO_MAP
envi_convert_file_coordinates, r_fid, xF, yF, xMap, yMap
envi_file_query, r_fid, dims=r_dims, ns=r_ns, nl=r_nl, nb=r_nb,bnames=r_bnames
roi_id = envi_create_roi(color=i+2, name=re_roi_name[i], ns=r_ns,nl=r_nl)
envi_define_roi, roi_id, /polygon, xpts=XF, ypts=YF
re_roi_id[i] = roi_id
endfor
roi_filename = 'image_rois_resized.roi'
envi_save_rois, roi_filename, re_roi_id
In desperate need of help, thanks a lot!!!