;----------------------------------------------------------------- ; lee.pro ; ; 06/2001 by Andreas Reigber ;------------------------------------------------------------------ ; Lee filter for multiplicative image noise using local statistics. ; Very useful for speckle reduction of SAR amplitude images. More in: ; J.S.Lee: "Speckle analysis and smoothing of Synthetic Aperture ; Radar Images", Comp. Graph. Image Process. Vol. 17, pp. 24-32, 1981 ; ; This implementation is faster and better suited for SAR images ; than the Lee-filter included in IDL. ; ; Usage: ; res = lee(image,size) ; ; image = floating point image amplitude ; size = size of the filter window ; ; Keywords: ; ; looks = Number of looks (default = 1) ; ;------------------------------------------------------------------ ; This software has been released under the terms of the GNU Public ; license. See http://www.gnu.org/copyleft/gpl.html for details. ;------------------------------------------------------------------ function lee,amp,smm,LOOKS=looks if not keyword_set(looks) then looks=1 siz = size(amp) anz_rg = siz[1] anz_az = siz[2] delta = (smm-1)/2 sig2 = 1.0/looks sfak = 1.0+sig2 zfak = smm^2-1 out = amp-amp fbox = mbox(smm,anz_rg) for i=delta,anz_rg-delta-1 do begin for j=delta,anz_az-delta-1 do begin pos = i+j*anz_rg box = amp[pos+fbox] mean = avg(box) mean2= mean^2 z = total((box-mean)^2)/zfak z = ((z+mean2)/sfak)-mean2 > 0 out[pos] = mean + (amp[pos]-mean)*(z/(mean2*sig2+z)) endfor endfor return,out end