Example #1
0
        /// <summary>
        /// Выдает точки
        /// </summary>
        /// <param name="img">Матрица серого изображения</param>
        public Vector GetPoints(Matrix img)
        {
            GenVectorPoint(img);
            Vector real = points.MagnitudeToVector().CutAndZero(n);
            Vector im   = points.MagnitudeToVector().CutAndZero(n);

            real /= Statistic.MaximalValue(real);
            im   /= Statistic.MaximalValue(im);

            real -= Statistic.ExpectedValue(real);
            im   -= Statistic.ExpectedValue(im);

            return(Vector.Concatinate(new Vector[] { real, im }));
        }
Example #2
0
        // Генерация вектора фич
        private Vector GenFeature()
        {
            ComplexVector cV = Furie.fft(points);
            double        k, cP1, cP2;
            Complex       kR;

            if (!_isScale)
            {
                cP1 = cV[0].Magnitude;
                cP2 = cV[cV.N - 1].Magnitude;
                k   = Math.Sqrt(cP1 * cP1 + cP2 * cP2);
                cV /= k;
            }


            if (!_isRot)
            {
                cP1 = cV[0].Phase;
                cP2 = cV[cV.N - 1].Phase;
                kR  = Complex.Exp(new Complex(0, 1) * (cP2 - cP1) / 2.0);
                cV *= kR;
            }

            if (!_isMove)
            {
                cV[0] = 0;
            }

            cV = cV.CutAndZero(n);

            Vector modules = cV.MagnitudeToVector();
            Vector phases  = cV.PhaseToVector();

            return(phases);//Vector.Concatinate(new Vector[]{modules, phases});
        }
Example #3
0
        /// <summary>
        /// Быстрое кепстральное преобразование
        /// </summary>
        /// <param name="signal">Сигнал</param>
        /// <returns></returns>
        public static Vector FKT(ComplexVector signal)
        {
            ComplexVector spectr  = Furie.fft(signal);
            Vector        Aspectr = MathFunc.ln(spectr.MagnitudeToVector().TransformVector(x => x * x));

            return(Furie.fft(Aspectr).RealToVector() / Aspectr.N);
        }