public GrayImg SimpleMotionDeblur(double length, double lambda) { GrayImg oext = Extend(); SimpleMotionKernel smk = new SimpleMotionKernel(oext.Width, oext.Height, length); GrayImg rext = new GrayImg(oext.Width, oext.Height); oext.FFT2(); smk.FFT2(); int i, scale = oext.Width * oext.Height; double d, s; for (i = 0; i < scale; ++i) { smk[i] += 0.0000001; d = smk[i].ModulusSquared; s = d / (d + lambda); rext[i] = (oext[i] / smk[i]) * s; } rext.BFFTShift(); rext.IFFT2(); return(rext.UnExtend(_Width, _Height)); }