X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 14 Sep 2014 11:54 PM by  anon
Optimum Index Factor (OIF) using ENVI
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
14 Sep 2014 11:54 PM
    Hi, How to calculate Optimum Index Factor (OIF) for color combination using ENVI? Thank you Mahmoud where: Stdi standard deviation of band i Stdj standard deviation of band j Stdk standard deviation of band k Corrij correlation coefficient of band i and band j Corrik correlation coefficient of band i and band k Corrjk correlation coefficient of band j and band k

    Deleted User



    New Member


    Posts:
    New Member


    --
    15 Sep 2014 06:00 AM
    Hi Mahmoud, Not sure that ENVI can do it, but ENVI+IDL can. pro oif_example compile_opt IDL2 envi, /restore_base_save_files envi_select, fid=i_fid,dims=dims,pos=pos, $ title='OIF calculation Input File' if (i_fid[0] eq -1) then return envi_file_query, i_fid, ns=ns, nl=nl, nb=nb, data_type=data_type, $ dims=dims, bname=bname if nb ge 3 and n_elements(pos) ge 3 then begin envi_doit, 'envi_stats_doit', fid=i_fid, pos=pos, $ dims=dims, comp_flag=4, stdv=stdv, cov=cov ncomb=fix(factorial(n_elements(pos))/(factorial(3)*factorial(n_elements(pos)-3))) oif_struct = replicate(create_struct('BandCombination', '','OIF', 0.0),ncomb) index=0 for i=0, n_elements(pos)-1 do begin for j=0, n_elements(pos)-1 do begin for k=0, n_elements(pos)-1 do begin if (i lt j) and (i lt k) and (j lt k) then begin oif_struct[index].(0)=bname[pos[i]]+'|'+bname[pos[j]]+'|'+bname[pos[k]] oif_struct[index].(1)=(stdv[i]+stdv[j]+stdv[k])/(cov[i,j]/(stdv[i]*stdv[j])+cov[i,k]/(stdv[i]*stdv[k])+cov[j,k]/(stdv[j]*stdv[k])) index=index+1 endif endfor endfor endfor endif mes=string((oif_struct[reverse(sort(oif_struct.(1)))])[0].(0)) Result = dialog_message(mes, /INFORMATION) for str=0,ncomb-1 do begin print, (oif_struct[reverse(sort(oif_struct.(1)))])[str] endfor end

    Deleted User



    New Member


    Posts:
    New Member


    --
    12 May 2015 08:15 PM
    dear alex,,, i've tried using your script to find OIF for hyperion data (242 bands) unfortunately, there's something error on it " % Array dimensions must be greater than 0. % Execution halted at: OIF_EXAMPLE 15 C:\Users\user\IDLWorkspace71\Default\oif_example.pro" could you inform me, why this could be happen? i'm new on IDL script, so it would be great if you could help me out. thank you
    You are not authorized to post a reply.