Esempio n. 1
0
        private char OcrBlock(IotaVtiOcrProcessor stateManager, uint[] image, int startingPosition, bool isOddField, out int rating)
        {
            uint[] block = stateManager.GetBlockAtXOffset(image, startingPosition, isOddField);

            int[] diffSignatures = new int[10];
            int[] diffDigits     = new int[10];
            diffSignatures[0] = GetDiffSignature(block, stateManager.ZeroDigitPattern);
            diffDigits[0]     = 0;
            diffSignatures[1] = GetDiffSignature(block, stateManager.OneDigitPattern);
            diffDigits[1]     = 1;
            diffSignatures[2] = GetDiffSignature(block, stateManager.TwoDigitPattern);
            diffDigits[2]     = 2;
            diffSignatures[3] = GetDiffSignature(block, stateManager.ThreeDigitPattern);
            diffDigits[3]     = 3;
            diffSignatures[4] = GetDiffSignature(block, stateManager.FourDigitPattern);
            diffDigits[4]     = 4;
            diffSignatures[5] = GetDiffSignature(block, stateManager.FiveDigitPattern);
            diffDigits[5]     = 5;
            diffSignatures[6] = GetDiffSignature(block, stateManager.SixDigitPattern);
            diffDigits[6]     = 6;
            diffSignatures[7] = GetDiffSignature(block, stateManager.SevenDigitPattern);
            diffDigits[7]     = 7;
            diffSignatures[8] = GetDiffSignature(block, stateManager.EightDigitPattern);
            diffDigits[8]     = 8;
            diffSignatures[9] = GetDiffSignature(block, stateManager.NineDigitPattern);
            diffDigits[9]     = 9;

            Array.Sort(diffSignatures, diffDigits);

            if (stateManager.IsMatchingSignature(diffSignatures[0]))
            {
                if (diffDigits[0] == 8 || diffDigits[0] == 6 || diffDigits[0] == 9)
                {
                    // If we matched to a 6, 8 or 9, then do additional check as those three characters are too similar
                }

                rating = diffSignatures[0];
                return(diffDigits[0].ToString()[0]);
            }

            rating = int.MaxValue;
            return(' ');
        }
Esempio n. 2
0
 public void PrepareLastTwoDigitsFromTheFrameNumber(IotaVtiOcrProcessor stateManager, int lastBlockX, int secondLastBlockX)
 {
     LastFrameNoDigit       = stateManager.GetBlockAtXOffset(Image, lastBlockX, IsOddField);
     SecondLastFrameNoDigit = stateManager.GetBlockAtXOffset(Image, secondLastBlockX, IsOddField);
 }