Exemple #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));
        }
Exemple #2
0
        public GrayImg InsideSimpleMotionDeblur(SimpleMotionKernel smk, double lambda)
        {
            GrayImg rext = new GrayImg(_Width, _Height);
            int     i, scale = _Width * _Height;
            double  d, s;

            for (i = 0; i < scale; ++i)
            {
                smk[i] += 0.0000001;
                d       = smk[i].ModulusSquared;
                s       = d / (d + lambda);
                rext[i] = (this[i] / smk[i]) * s;
            }
            return(rext);
        }
Exemple #3
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));
        }