Algorithmix.Forensics.OCR.ShredOcr C# (CSharp) Метод

ShredOcr() публичный статический Метод

Given an array of shreds, we OCR them all and save results to the shred object
public static ShredOcr ( Shred shreds, string lang = "eng" ) : void
shreds Shred Array of initialized shred objects
lang string Desired OCR langauge
Результат void
        public static void ShredOcr(Shred[] shreds, string lang = "eng")
        {
            Bitmap[] images = new Bitmap[shreds.Length];
            Bitmap[] reversed = new Bitmap[shreds.Length];
            int index = 0;
            foreach (Shred shred in shreds)
            {
                images[index] = new Bitmap(shred.Filepath);
                reversed[index] = Filter.Reverse(images[index]);
                index += 1;
            }
            Tuple<long, OcrData, OcrData>[] results = ParallelDetectOrientation(images, reversed, Accuracy.Low, lang);

            for (int ii = 0; ii < results.Length; ii++)
            {
                long confidence = results[ii].Item1;
                if (confidence > 0)
                {
                    shreds[ii].AddOcrData(results[ii].Item2, Math.Abs(confidence), false);
                }
                else if (confidence <= 0)
                {
                    shreds[ii].AddOcrData(results[ii].Item3, Math.Abs(confidence), true);
                }
            }
        }