Beispiel #1
0
        public void GetNewWords()
        {
            Bitmap imageFile;

            if (Program.UseCaptureScreenshot)
            {
                imageFile = new Bitmap(ScreenCaptureHelper.CaptureDesktop());
            }
            else
            {
                imageFile = GetImageByFile();
            }


//            imageFile = new Bitmap("../../../data/results.png");

            List <string> newCommonWords = GetNewCommonWords(imageFile);

            NewWordHelper.SaveCommonWords(newCommonWords);

            List <string> newObscureWords = GetNewObscureWords(imageFile);

            NewWordHelper.SaveObscureWords(newObscureWords);
        }
Beispiel #2
0
        public char[] RetrieveCharacters()
        {
            DateTime now = DateTime.Now;

            Bitmap imageFile;

            if (Program.UseCaptureScreenshot)
            {
                imageFile = new Bitmap(ScreenCaptureHelper.CaptureDesktop());
            }
            else
            {
                imageFile = GetImageByFile();
            }

            Bitmap roi = GetPlayingfield(imageFile);

            Bitmap[] constructGroups = ConstructGroups(roi);

            Bitmap[] defineBackground = SetThreshold(constructGroups);

            List <char> chars = new List <char>();

            foreach (Bitmap bitmap in defineBackground)
            {
                chars.AddRange(RetrieveCharsByOcr(bitmap, Program.TessDataDir));
            }

            var charArray = chars.ToArray();

            double amountmiliseconds1 = (DateTime.Now - now).TotalMilliseconds;

            Console.WriteLine("Time retrieving chardata from image: " + amountmiliseconds1);

            return(charArray);
        }