Пример #1
0
        private void OnRank(object sender, System.EventArgs e)
        {
            m_Undo = (Bitmap)m_Bitmap.Clone();
            BitmapFilter.GrayToBlack(m_Bitmap, BRIGHT);
            Bitmap[]   arr = FontMethods.ImageToTextR1(m_Bitmap);
            Bitmap[][] br  = new Bitmap[arr.Length][];
            Bitmap[]   cr  = new Bitmap[arr.Length];
            for (int i = 0; i < arr.Length; i++)
            {
                br[i] = FontMethods.ImageToTextR2(arr[i]);
                cr[i] = FontMethods.JoinBitmap(br[i]);
            }
            m_Bitmap               = FontMethods.JoinBitmapH(cr);
            this.AutoScroll        = true;
            this.AutoScrollMinSize = new Size((int)(m_Bitmap.Width * Zoom), (int)(m_Bitmap.Height * Zoom));
            this.Invalidate();

            Bitmap[][] brcop   = new Bitmap[arr.Length][];
            List <ABC> listABC = new List <ABC>();

            for (int i = 0; i < arr.Length; i++)
            {
                Bitmap[] bbcop = new Bitmap[br[i].Length];
                for (int j = 0; j < br[i].Length; j++)
                {
                    bbcop[j] = (Bitmap)br[i][j].Clone();
                    bbcop[j] = FontMethods.BoundCore(bbcop[j]);
                    int[] fra = FontMethods.Fragment(bbcop[j]);

                    //FontMethods.ImageToBackBone(br[i][j]);
                    br[i][j] = FontMethods.BoundCore(br[i][j]);
                    double[]   d      = FontMethods.AverageSquare(br[i][j]);
                    double[][] ad     = FontMethods.Margin(br[i][j]);
                    ABC        strABC = new ABC();
                    strABC.AverageSquare    = d;
                    strABC.ProportionSquare = strABC.AverageSquare[1] == 0 ? 0 : strABC.AverageSquare[0] / strABC.AverageSquare[1];
                    strABC.Margin           = ad;
                    strABC.Fragment         = fra;
                    listABC.Add(strABC);
                }
            }
            string mes = String.Join("\n", listABC);

            Clipboard.SetText(mes);
            MessageBox.Show(mes);
        }
Пример #2
0
 private void OnImageToTextR1(object sender, System.EventArgs e)
 {
     m_Undo = (Bitmap)m_Bitmap.Clone();
     BitmapFilter.GrayToBlack(m_Bitmap, BRIGHT);
     Bitmap[]   arr = FontMethods.ImageToTextR1(m_Bitmap);
     Bitmap[][] br  = new Bitmap[arr.Length][];
     Bitmap[]   cr  = new Bitmap[arr.Length];
     for (int i = 0; i < arr.Length; i++)
     {
         br[i] = FontMethods.ImageToTextR2(arr[i]);
         cr[i] = FontMethods.JoinBitmap(br[i]);
     }
     m_Bitmap               = FontMethods.JoinBitmapH(cr);
     m_Bitmap               = br[0][7];
     this.AutoScroll        = true;
     this.AutoScrollMinSize = new Size((int)(m_Bitmap.Width * Zoom), (int)(m_Bitmap.Height * Zoom));
     this.Invalidate();
 }
Пример #3
0
        private void OnSynthetic(object sender, System.EventArgs e)
        {
            List <ABC> des    = new List <ABC>();
            List <ABC> predic = new List <ABC>();

            int im = 0;

            if (im == 0)
            {
                string[]   arrdic  = new String[] { "田", "字", "奉", "膂", "雪", "こ", "や", "至", "一", "だ", "ほ", "’", "ん", "と" };
                Bitmap[]   br      = new Bitmap[arrdic.Length];
                Bitmap[]   brcop   = new Bitmap[arrdic.Length];
                List <ABC> listABC = new List <ABC>();

                for (int i = 0; i < arrdic.Length; i++)
                {
                    br[i] = (Bitmap)FontMethods.Render(arrdic[i]);
                    BitmapFilter.GrayToBlack(br[i], BRIGHT);
                    brcop[i] = (Bitmap)br[i].Clone();
                    brcop[i] = FontMethods.BoundCore(brcop[i]);
                    int[] fra = FontMethods.Fragment(brcop[i]);

                    //FontMethods.ImageToBackBone(br[i]);
                    br[i] = FontMethods.BoundCore(br[i]);
                    double[]   d      = FontMethods.AverageSquare(br[i]);
                    double[][] ad     = FontMethods.Margin(br[i]);
                    ABC        strABC = new ABC();
                    strABC.KEY              = arrdic[i];
                    strABC.AverageSquare    = d;
                    strABC.ProportionSquare = strABC.AverageSquare[1] == 0 ? 0 : strABC.AverageSquare[0] / strABC.AverageSquare[1];
                    strABC.Margin           = ad;
                    strABC.Fragment         = fra;
                    listABC.Add(strABC);
                }
                predic = listABC;
            }

            im = 1;
            if (im == 1)
            {
                m_Undo = (Bitmap)m_Bitmap.Clone();
                BitmapFilter.GrayToBlack(m_Bitmap, BRIGHT);
                Bitmap[]   arr = FontMethods.ImageToTextR1(m_Bitmap);
                Bitmap[][] br  = new Bitmap[arr.Length][];
                Bitmap[]   cr  = new Bitmap[arr.Length];
                for (int i = 0; i < arr.Length; i++)
                {
                    br[i] = FontMethods.ImageToTextR2(arr[i]);
                    cr[i] = FontMethods.JoinBitmap(br[i]);
                }
                m_Bitmap               = FontMethods.JoinBitmapH(cr);
                this.AutoScroll        = true;
                this.AutoScrollMinSize = new Size((int)(m_Bitmap.Width * Zoom), (int)(m_Bitmap.Height * Zoom));
                this.Invalidate();

                Bitmap[][] brcop   = new Bitmap[arr.Length][];
                List <ABC> listABC = new List <ABC>();
                for (int i = 0; i < arr.Length; i++)
                {
                    Bitmap[] bbcop = new Bitmap[br[i].Length];
                    for (int j = 0; j < br[i].Length; j++)
                    {
                        bbcop[j] = (Bitmap)br[i][j].Clone();
                        bbcop[j] = FontMethods.BoundCore(bbcop[j]);
                        int[] fra = FontMethods.Fragment(bbcop[j]);

                        //FontMethods.ImageToBackBone(br[i][j]);
                        br[i][j] = FontMethods.BoundCore(br[i][j]);
                        double[]   d      = FontMethods.AverageSquare(br[i][j]);
                        double[][] ad     = FontMethods.Margin(br[i][j]);
                        ABC        strABC = new ABC();
                        strABC.AverageSquare    = d;
                        strABC.ProportionSquare = strABC.AverageSquare[1] == 0 ? 0 : strABC.AverageSquare[0] / strABC.AverageSquare[1];
                        strABC.Margin           = ad;
                        strABC.Fragment         = fra;
                        listABC.Add(strABC);
                    }
                }
                des = listABC;
            }
            FncSynthetic(des, predic);
        }