I had a Quickbird image and after running the FLAASH, I would like to normalize the image as following: if the pixel>0 or =10000, multiply it by 1; if pixel < or = 0 multiple it by 0; if pixel >0 and <10000 multiple it by its float value and devide the result by 10 000.
I wrote the IDL code as following, but my conditional statement is error. Could you please help me to fix the conditional statement.
Thanks so much for your help.
Lien
My IDL code:
pro correct_reflec
fname='D:\Quick\BA.dat'
envi_open_file, fname, r_fid=fid,NO_REALIZE=1
ENVI_FILE_QUERY,fid,DIMS=dims,NS=ns,NL=nl,NB=nb, pos=pos
map_info=envi_get_map_info(fid=fid)
b1 = ENVI_GET_DATA(FID=fid, dims=dims, pos=1)
ns=n_elements(b1[*,0])
nl=n_elements(b1[0,*])
br=fltarr(ns,3,nl)
CASE 1 of
b1 le 0: br(*,0,*) = (b1)*0
b1 ge 10000: br(*,0,*)= (b1)* 1
else: br(*,0,*)= b1*foat(b1)/(10000)
ENDCASE
b2 = ENVI_GET_DATA(FID=fid, dims=dims, pos=1)
CASE 1 of
b2 le 0: br(*,1,*) = b2*0
b2 ge 10000:br(*,1,*)=b2*1
else: br(*,1,*)=b2*foat(b2)/10000
ENDCASE
b3 = ENVI_GET_DATA(FID=fid, dims=dims, pos=2)
CASE 1 of
b3 le 0:br(*,2,*) = b3*0
b3 ge 10000: br(*,2,*)=b3*1
else br(*,2,*)=b3*foat(b3)/10000
ENDCASE
envi_write_envi_file, br, map_info=map_info, out_name='D:\Quick\test', r_fid=fid
END