{ Here's a macro for "coring" an image. First the image is high-pass filtered, then these highs are "cored", which means values near zero (you tell it how near) are set to zero, and values outside that range are moved closer to zero by the amount of the coring width. A low-pass image is formed by subtracting the highs from the original, and the cored highs are added to the lows. This approach works well if your image has edges separated by noise-infested flat areas. Norm Hurst David Sarnoff Research Center 609-734-2925 } procedure HPF; {This is an impulse filter (all zeros with a 1 in the middle) minus a 5x5 average (5x5 1's divided by 25), then scaled so the smallest tap is 1 (i.e. times 25).} begin RequiresVersion(1.53); NewTextWindow('3x3 mean diff',100,100); {THESE TAPS ARE NOT MAGIC, BUT THEY MUST ADD TO ZERO} writeln('-1 -1 -1'); writeln('-1 8 -1'); writeln('-1 -1 -1'); Convolve(''); Dispose; end; procedure Core(w,c:integer) var i,y:integer; begin for i:=1 to 254 do begin y := (255-i)-c; if abs(y) < w then y := 0 else begin if y>0 then y:=y-w else y:=y+w end; RedLUT[i]:=y+c; GreenLUT[i]:= y+c; BlueLUT[i]:=y+c; end; UpdateLUT; ApplyLUT; end; macro 'Core Noise [C]' var orig,hp,lp,result, width:integer; name:string; begin RequiresVersion(1.53); width := GetNUmber('Coring Width',10); name := WindowTitle; orig := PidNumber; Duplicate(''); HPF; hp := PidNumber; ImageMath('sub',orig,hp,1,127,'Low Pass'); lp := PidNumber; SelectPic(hp); Core(width,127); ImageMath('add',lp,hp,1,-127,'Cored'); result := PidNumber; SetPicName(name,' Cored'); SelectPic(hp); Dispose; SelectPic(lp); Dispose; SelectPic(result); end