Ejemplo n.º 1
0
        /// <summary>
        /// This method is preparing Learning Matrix basis on image from LearningPictures
        /// </summary>
        /// <returns></returns>
        private double[][] CreateLearningMatrix()
        {
            //loading and cuting learning matrix for each character
            GraphicProcessing graph = new GraphicProcessing();
            Bitmap            mBitmap;

            System.Drawing.Image img = histogramAforge.Properties.Resources.learningAll;
            mBitmap = new Bitmap(img);
            Grayscale greyScaleFilter = new Grayscale(1.0, 0.0, 0.0);

            mBitmap = greyScaleFilter.Apply(mBitmap);
            Threshold tresholdFilter = new Threshold(120);

            tresholdFilter.ApplyInPlace(mBitmap);
            List <Bitmap> listOfCharacters = graph.ProcesLearningImage(mBitmap);

            //crate input matrix for each character to learn NN
            double[][] learnigTable = new double[listOfCharacters.Count][];
            int        i            = 0;

            foreach (Bitmap map in listOfCharacters)
            {
                learnigTable[i] = CreteInputMatrix(map);
                i++;
            }

            return(learnigTable);
        }
Ejemplo n.º 2
0
 private void openToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         pictureBox1.Image = (Bitmap)System.Drawing.Image.FromFile(openFileDialog1.FileName);
         Bitmap imageSecond;
         imageSecond = (Bitmap)System.Drawing.Image.FromFile(openFileDialog1.FileName);
         Grayscale greyScaleFilter = new Grayscale(1.0, 0.0, 0.0);
         imageSecond = greyScaleFilter.Apply(imageSecond);
         Threshold tresholdFilter = new Threshold(120);
         tresholdFilter.ApplyInPlace(imageSecond);
         pictureBox2.Image = imageSecond;
         imageSecond.Save("imageSecond.bmp");
         GraphicProcessing graphicProcesing = new GraphicProcessing();
         CharactersList = graphicProcesing.ProcesImage(imageSecond);
         LoadCharacterToView();
     }
 }