Direkt zum InhaltDirekt zur SucheDirekt zur Navigation
▼ Zielgruppen ▼

Humboldt-Universität zu Berlin - Faculty of Mathematics and Natural Sciences - Strukturforschung / Elektronenmikroskopie

GaussEdgeSmoothing.txt

number width, height, h2,w2
number Gwidth = 10; // width of Gaussian in pixels in reciprocal space
number Nedge = 100; // width of smoothed edge in pixels

// obtain selected image and get its size:
Image img=getFrontImage()
getSize(img,width,height)
h2 = height/2;
w2 = width/2;

// produce a Gaussian of equal size
ComplexImage Gauss:=ExprSize(width,height,exp(-((irow-h2)**2+(icol-w2)**2)/(Gwidth**2)))

// convolute image with Gaussian
Image img2 = realifft(realfft(img)*Gauss)

// replace edge of original image with smoothed image:
Image img3 = tert((abs(icol-w2)<w2-Nedge)&&(abs(irow-h2)<h2-Nedge),img,img2)

showimage(img3)