X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 10 Nov 2015 02:25 PM by  anon
spectral math for performing mathematical operations
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
10 Nov 2015 02:25 PM
    <p>Dear forum members,<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> <br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp; &nbsp; &nbsp; &nbsp; Lately I was trying to use ENVI software to perform a mathematical operation for some data cubes I collected from a hyper spectral system. The process can be summarized as below: the hyper spectral system usually generate 3 data cube files: one for the raw data collected from the sample, another is the white reflectance data cube to correct the lamp intensity profile, and the other for the dark counts.<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> <br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;To get a normalized data cube, I need to perform (raw data- dark data)/(white reflectance - dark data)*(max count value). I was experimenting on using ENVI spectral math to perform this operation, i.e. define an expression (s1-s3)/(s2-s3)*4095, (max count value = 4095), and assign raw data cube to s1, white reflectance cube to s2, and dark data cube to s3, and then spatial and spectral subsetting using full scene and all bands, however, the output data cube (normalized data cube) seems to be a different result than I'd expect. I calculated the numerical values in matlab using the same expression (Normalized=(Rawdata-<wbr style="color: #222222; font-family: arial, sans-serif; font-size: 13px;"></wbr>darkedata)./(whitedata-<wbr style="color: #222222; font-family: arial, sans-serif; font-size: 13px;"></wbr>darkedata)*4095; the result is good. For some reason in spectral math, the output normalized data cube is not matching. So I was wondering if there is anything I did wrong or something. All our data cubes are 1456x1936x65 (bsq formatted). I attach the representative header file for the original 3 cubes below. So I noticed that the interleave has been changed from BSQ to BIL for the spectral math calculated data cube, I'm wondering if this has something to do with it.<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> <br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Please let me know if you have any suggestions. Really appreciate your time and help.<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> <br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> Sincerely,<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> <br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> Hao<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> <br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> <br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> For raw data cube:<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> <br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> ENVI<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> description = ENVI Data Cube<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> samples = 1936<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> lines = 1456<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> bands = 65<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> header offset = 0<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> file type = ENVI Standard<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> data type = 2<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> interleave = BSQ<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> byte order = 1<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> band names = {400.000 nm,405.000 nm,410.000 nm,415.000 nm,420.000 nm,425.000 nm,430.000 nm,435.000 nm,440.000 nm,445.000 nm,450.000 nm,455.000 nm,460.000 nm,465.000 nm,470.000 nm,475.000 nm,480.000 nm,485.000 nm,490.000 nm,495.000 nm,500.000 nm,505.000 nm,510.000 nm,515.000 nm,520.000 nm,525.000 nm,530.000 nm,535.000 nm,540.000 nm,545.000 nm,550.000 nm,555.000 nm,560.000 nm,565.000 nm,570.000 nm,575.000 nm,580.000 nm,585.000 nm,590.000 nm,595.000 nm,600.000 nm,605.000 nm,610.000 nm,615.000 nm,620.000 nm,625.000 nm,630.000 nm,635.000 nm,640.000 nm,645.000 nm,650.000 nm,655.000 nm,660.000 nm,665.000 nm,670.000 nm,675.000 nm,680.000 nm,685.000 nm,690.000 nm,695.000 nm,700.000 nm,705.000 nm,710.000 nm,715.000 nm,720.000 nm}<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> <br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> <br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> For normalized data cube from spectral math:<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> <br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> ENVI<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> description = {<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp; Spectral Math Result, Exp = [(s1-s3)/(s2-s3)*(4095)] [Mon Nov 9 13:09:18<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp; 2015]}<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> samples = 1936<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> lines&nbsp; &nbsp;= 1456<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> bands&nbsp; &nbsp;= 65<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> header offset = 0<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> file type = ENVI Standard<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> data type = 2<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> interleave = bil<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> sensor type = Unknown<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> byte order = 0<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> wavelength units = Unknown<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> band names = {<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (400.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (405.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (410.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (415.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (420.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (425.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (430.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (435.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (440.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (445.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (450.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (455.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (460.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (465.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (470.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (475.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (480.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (485.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (490.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (495.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (500.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (505.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (510.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (515.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (520.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (525.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (530.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (535.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (540.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (545.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (550.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (555.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (560.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (565.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (570.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (575.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (580.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (585.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (590.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (595.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (600.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (605.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (610.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (615.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (620.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (625.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (630.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (635.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (640.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (645.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (650.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (655.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (660.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (665.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (670.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (675.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (680.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (685.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (690.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (695.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (700.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (705.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (710.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (715.000 nm),<br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /> &nbsp;Spec Math (720.000 nm)},</p>

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    11 Nov 2015 11:37 AM
    <p>I think you could also perform this same calculation in Band Math and map the variables to the data files.&nbsp; I noticed your data is stored as integers and your equation did not promote the data type to ensure you avoid data overflow.&nbsp; You might try the following:</p> <p>(float(s1)-float(s3))/(float(s2)-float(s3))*4095.0</p> <p>Perhaps this is the difference?</p>

    Deleted User



    New Member


    Posts:
    New Member


    --
    12 Nov 2015 12:01 PM
    <p>Thanks a ton, Mari. I tried both band math and spectral math. both have worked well as you have suggested. Thanks a lot for your timely response.&nbsp;</p> <p><br /> </p> <p>Sincerely,</p> <p>Hao Wang</p>
    You are not authorized to post a reply.