Esempio n. 1
0
        public static IEnumerable <CvBlob> DetectAndFilterBlobs(Image <Gray, byte> img, int min, int max)
        {
            CvBlobs blobs = new CvBlobs();

            PerThreadUtils.GetBlobDetector().Detect(img, blobs);
            blobs.FilterByArea(min, max);
            return(blobs.Values);
        }
Esempio n. 2
0
        public static string ReadTextFromImage(Image <Gray, byte> img, DebugState debugState)
        {
            debugState.Add(img);

            var ocr = PerThreadUtils.GetTesseract();

            ocr.SetImage(img);
            ocr.Recognize();

            var str = "";

            foreach (var c in ocr.GetCharacters())
            {
                str += c.Text.Trim().ToUpper();
            }

            str = str.Replace("'", "").Replace(".", "").Replace("‘", "").Replace("’", "").Replace("\"", "").Replace(",", "").Replace(":", "");
            return(str);
        }