Esempio n. 1
0
        public string[] GetScaners()
        {
            var deviceManager = new DeviceManager();
            var scaners       = WIAScanner.GetDevices();

            return(scaners.ToArray());
        }
Esempio n. 2
0
        // public string ScanAndOCR()
        // {
        //    var images = WIAScanner.Scan();
        //    string result = string.Empty;

        // using (var ms = new MemoryStream())
        //    {
        //        images[0].Save(ms, images[0].RawFormat);
        //        result = this.api.RecognizeImage(ms);
        //    }

        // return result;
        // }
        public IEnumerable <string> ScanTessOCR()
        {
            var images = WIAScanner.Scan();
            var result = new List <string>();

            using (var ms = new MemoryStream())
            {
                foreach (var image in images)
                {
                    image.Save(ms, image.RawFormat);
                    var pic = Pix.LoadFromMemory(ms.ToArray()).Deskew();
                    pic.Save("ocrImg.png", ImageFormat.Png);

                    var res = this.ocr.Process(pic);
                    result.Add(res.GetText().Trim());
                }
            }

            return(result);
        }
Esempio n. 3
0
 public List <Image> Scan()
 {
     return(WIAScanner.Scan());
 }