Exemplo n.º 1
0
        private Image RecognizeImage(Image image)
        {
            int[] vector = image.ToVector();
            RowVector X = new RowVector(vector.Length);

            for (int i = 0; i < X.ColumnCount; i++)
            {
                X[i] = vector[i];
            }

            ColumnVector sMatrix = W * X.Transpose();

            int[] Y = new int[sMatrix.RowCount];
            for (int i = 0; i < Y.Length; i++) {
                Y[i] = sMatrix[i] > 0 ? 1 : -1;
            }

            return Image.GetImage(Y, image.Width, image.Height);
        }