Jump to content
Sign in to follow this  
babyshoone

Find pixels to extract information with envi.

Recommended Posts

Hello sensors,

 

I have to extract information that the pixel containe in landsat 8 image with envi 4.8, I used point collection tool, I opened the ASCII file that containe the coordinates of my point samples and I click on "goto", a message tel me that the point is out of image, although I'm sure that the points are in. now I use "corsore location" tool and i seek for the point one by one, it's vey slow. 

 

in the other side I used Qgis, I opened the landsat image, I créat the "shp" that containe my points and coordinats, and I used the "point sampl tool", the new files created containe no informations, the tool didn't extracts information from the image and I'm sure that the pixels containe the information "NDVI"

 

Thank you for help.

 

PS: how to put a  screenshot I click on image icone a windows of URL of image open. !!!

Share this post


Link to post
Share on other sites

Hi Babyshoone!!!

 on ENVI & IDL is easy run the script roi_to_csv.pro.... And is great for many  layers stack!!!!

 

pro rois_to_csv
  ;Select file name to save
 filename=dialog_pickfile(Title='Enter File Name')
 if filename eq '' then return
 Openw, lun, filename, /Get_lun
  envi_select, title='Input Filename', fid=fid, pos=pos
  if (fid eq -1) then return
  envi_file_query,fid,bname=bname,nb=nb
  bname=["ROI_Name",bname]
  printf,FORMAT='(1000(A,:,","))',lun, bname
  ;Check ROIs associated with the image
  roi_ids = envi_get_roi_ids(fid=fid, roi_names=roi_names,/Short_name)
  if (roi_ids[0] eq -1) then begin
    print, 'No regions associated with the selected file'
    return
  endif
  ; Compound widget for ROI selection
  base = widget_auto_base(title='ROI Selection')
  wm   = widget_multi(base, list=roi_names, uvalue='list', /auto)
  result = auto_wid_mng(base)
  if (result.accept eq 0) then return
  ptr = where(result.list eq 1, count)
  ; ROI data extraction
  for i=0l, count-1 do begin
     ;Initialize temp_data to hold the ROI's data
      data = envi_get_roi_data(roi_ids[ptr], fid=fid, $
      pos=[0])
      temp_data = fltarr(n_elements(pos),n_elements(data))
      ;Extract the data for each ROI
       for j=0l, n_elements(pos)-1 do begin
               data = envi_get_roi_data(roi_ids[ptr], fid=fid, $
               pos=pos[j])
               temp_data[j,*] = data
               help, temp_data
           endfor
       ;Prints the ROI data to filename
           for k = 0L, n_elements(temp_data[0,*])-1 do begin
               printf, FORMAT='(A,:,",",1000(F12.2,:,","))',lun, roi_names, temp_data[*,k]
           endfor
       ;Returns to the next ROI
  endfor
   Free_lun, lun
   print,'Done!'
end
 

Share this post


Link to post
Share on other sites

Hi Sigologo, thank u for the reply,

 

I  will try to use IDL and "skrip", but I have to tel you that I have no profeciency in IDL language, but I will try to do what you send me.

 

thanks.  

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.