X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 11 Nov 2008 08:35 PM by  anon
extracting digital numbers from ENVI image file
 5 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
11 Nov 2008 08:35 PM
    Hi,   I am rather new to ENVI and image processing in general. Can anyone pls tell me how I can extract the digital numbers (DN) from an image file? Mine is a SPOT 4 image, so each pixel has 4 separate DNs as I am not using the panchromatic band. Do I need to write some program to do it, or is there some function in ENVI that can do it too?   Thx in advance!

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    12 Nov 2008 07:47 AM
    Do you want to extract them to an ascii file or some other external file, or do you want to view them and perhaps store them as a spectral library?  There are several ways to view your data values: - From the Display menu ->Tools, bring up the Cursor Location/Value tool.  This will show you the DN of the current display pixel.  If you have a single band displayed, it shows the DN of that band.  If you have an RGB displayed, it shows the DN of each band of the display. - to view all DN of a single pixel in a multi-band file, right click on the display and select 'Z-profile'.  A z-profile shows you the DN of the pixel your cursor is on in every band in your file.  It is called a 'spectral profile'.  You can collect these profiles in a plot window and save them to ascii or to a spectral library file. - create an ROI and export to ASCII.  You can right click on your display and select the ROI Tool.  Draw ROIs around areas you are interested in.  You can plot these from the tool and save or you can save to ascii from the file menu.  The output text file will contain the DN of every pixel/every band in the ROI.  ROIs can be used in all sorts of processing in ENVI such as classification, masking, subsetting, etc. Give these a try and let me know if you have further questions.

    Deleted User



    New Member


    Posts:
    New Member


    --
    13 Nov 2008 01:46 AM
    hi mminari, your third suggestion really helped. however, is there a way to ASCII export the entire image? seems like ROIs always leave out some small edges, and merging several ROIs take quite a bit of time.

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    13 Nov 2008 07:10 AM
    ASCII files get very large if you are exporting the entire image.  You can do it via File ->Save file as->ASCII.  If you save all bands as once, the file is stored as a grid.  I would suggest you select one band at a time and export as xyz data if you really want to write out an entire band to ascii.  Is there some reason why you would want to do this?  Are you importing the data to another program for analysis?

    Deleted User



    New Member


    Posts:
    New Member


    --
    13 Nov 2008 06:20 PM
    yes, i am trying to convert the raw data that is collected by the satellite (ie SPOT 4 in my case) to other more useful quantities, such as top-of-atmosphere (TOA) radiance, etc, and ultimately to extract the water-leaving reflectances from the raw data. therefore, what i am thinking of doing is to extract all the pixel DN for the 4 bands, and to work with the ascii files directly. but your right, these files are rather huge and slow to work with. is there any other better way that is recommendable? i was told that it would be better to spectrally subset the data (basic tools --> resize data), then write a program to work with the data in these subsets. i am not too sure what the difference is between these subset data and ascii files though.

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    14 Nov 2008 10:58 AM
    If those are your plans, you might consider looking at this code contribution which calculates SPOT radiance: http://www.ittvis.com/Use...id/1143/Default.aspx Alternately, I would *not* suggest you export your data but instead use ENVI programming to apply whatever equation you want.  Binary files are much easier to work with than text files.  Have a look at the Band Math routine 'math_doit' for an idea of how you might apply an equation to a file.  Using ENVI's internal routines, you do not have to split up your data because it is large. ENVI 'tiles' the data when it processes it so memory and large files are not an issue. 
    You are not authorized to post a reply.