示例#1
0
        //read all
        bool ReadAll()
        {
            try
            {
                //when existence
                if (File.Exists("KeyboardAllStrings.asd"))
                {
                    //clear
                    KeyboardAllStrings.Clear();
                    KeyboardAllImage.Clear();
                    KeyboardAllConjunctionMatrix.Clear();


                    /* String Tem = File.ReadAllText("KeyboardAllStrings.asd");
                     * if (Tem.Length > 0)
                     * {
                     *   for (int i = 0; i < Tem.Length; i++)
                     *   {
                     *       KeyboardAllStrings.Add(Tem[i].ToString());
                     *   }
                     * }
                     * else
                     * {
                     *   bool Do = CreateString();
                     *   if (!Do)
                     *       return false;
                     * }*/
                    //serilized
                    Refrigtz.TakeRoot  tr = new Refrigtz.TakeRoot();
                    AllKeyboardOfWorld t  = tr.Load("KeyboardAllStrings.asd");
                    this.KeyboardAllConjunctionMatrix     = t.KeyboardAllConjunctionMatrix;
                    this.KeyboardAllConjunctionMatrixList = t.KeyboardAllConjunctionMatrixList;
                    this.KeyboardAllImage   = t.KeyboardAllImage;
                    this.KeyboardAllStrings = t.KeyboardAllStrings;
                }
                else//others retiurn unsuccessfull
                {
                    return(false);
                }
            }
            catch (Exception t) {
                //when unsuccessfull return false
                return(false);
            }
            //return true
            return(true);
        }
        //Constructor
        public DetectionOfLitteral(ref ImageTextDeepLearning.FormImageTextDeepLearning This, MainForm d)
        {
            try
            {
                dd = d;
                //This.SetCallSetLablr("Initiate All Key...");
                //This.RefCallSetLablr();
                t.ConvertAllStringToImage(d);
                //This.SetCallSetLablr("Initiate Conjunction...");
                //This.RefCallSetLablr();

                tt = new ConjunctedShape(d);
                //This.SetCallSetLablr("Cretion Conjuncted untile Mattix...");
                //This.RefCallSetLablr();
                tt.CreateSAhapeFromConjucted(Width, Heigh);
                //This.SetCallSetLablr("Initiate...");
                //This.RefCallSetLablr();
                ConjunctedShapeListRequired = new AllKeyboardOfWorld();
                //This.SetCallSetLablr("Initiate For Key Matrix...");
                //This.RefCallSetLablr();

                ConjunctedShapeListRequired.ConvertAllTempageToMatrix(tt.AllImage);
                //This.SetCallSetLablr("Detection...");
                //This.RefCallSetLablr();

                Detection(Width, Heigh);
            }
            catch (Exception te)
            {
                System.Windows.Forms.MessageBox.Show("Fatual Error!" + te.ToString());
            }
            finally
            {
                System.Windows.Forms.MessageBox.Show("Completed Detetcted " + Detected.Count);
            }
        }