Пример #1
0
        public BGRImg SimpleMotionDeblur(double length, double lambda)
        {
            BGRImg             oext = Extend();
            SimpleMotionKernel smk  = new SimpleMotionKernel(oext.Width, oext.Height, length);
            BGRImg             rext = new BGRImg(oext.Width, oext.Height);

            oext.FFT2();
            smk.FFT2();
            int    i, t, scale = oext.Width * oext.Height;
            double d, s;

            for (t = 0; t < 3; ++t)
            {
                for (i = 0; i < scale; ++i)
                {
                    smk[i]    += 0.0000001;
                    d          = smk[i].ModulusSquared;
                    s          = d / (d + lambda);
                    rext[t, i] = (oext[t, i] / smk[i]) * s;
                }
            }
            rext.BFFTShift();
            rext.IFFT2();
            return(rext.UnExtend(_Width, _Height));
        }
Пример #2
0
        public BGRImg SimpleMotionBlur(double length)
        {
            BGRImg             oext = Extend();
            SimpleMotionKernel smk  = new SimpleMotionKernel(oext.Width, oext.Height, length);
            BGRImg             rext = new BGRImg(oext.Width, oext.Height);

            oext.FFT2();
            smk.FFT2();
            int x, y, t;

            for (y = 0; y < oext.Height; ++y)
            {
                for (x = 0; x < oext.Width; ++x)
                {
                    for (t = 0; t < 3; ++t)
                    {
                        rext[t, x, y] = oext[t, x, y] * smk[x, y];
                    }
                }
            }
            rext.BFFTShift();
            rext.IFFT2();
            return(rext.UnExtend(_Width, _Height));
        }