Jump to content

Find pixels to extract information with envi.


babyshoone

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. !!!

Link to comment
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
 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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

Disable-Adblock.png

 

If you enjoy our contents, support us by Disable ads Blocker or add GIS-area to your ads blocker whitelist