Exemple #1
0
        public void RunOCR(Bitmap inputImage)
        {
            inputImagePV.Image = inputImage;
            Bitmap removeBorderImage = BorderRemoval.RemoveBorder(inputImage);

            removeBorderPV.Image = removeBorderImage;
            Bitmap removeNoiseImage = NoiseCleaner.RemoveNoiseWithBorder(removeBorderImage);

            noiseRemovalPV.Image = removeNoiseImage;
            Bitmap croppedImage = WhitespaceCropper.CropWhitespace(removeNoiseImage);

            croppedPV.Image = croppedImage;
            if (EmptyImageDetector.IsImageEmpty(croppedImage))
            {
                recognizedGradeLabel.Text       = "0";
                recognitionConfidenceLabel.Text = "empty";
            }
            else
            {
                Bitmap digestImage = DigestExtractor.ExtractDigestImage(croppedImage);
                digestPV.Image = digestImage;

                GradeDigest       digest            = GradeDigest.FromImage(digestImage);
                RecognitionResult recognitionResult = GradeOCR.Program.RecognizeGrade(digest);

                recognizedGradeLabel.Text       = recognitionResult.Grade.ToString();
                recognitionConfidenceLabel.Text = recognitionResult.Confident ? "sure" : "unsure";
            }
        }
Exemple #2
0
 public static Bitmap NormalizeImage(Bitmap img)
 {
     return
         (DigestExtractor.ExtractDigestImage(
              WhitespaceCropper.CropWhitespace(
                  NoiseCleaner.RemoveNoiseWithBorder(
                      BorderRemoval.RemoveBorder(img)))));
 }
Exemple #3
0
        public static Option <GradeDigest> GetGradeDigest(Bitmap img)
        {
            Bitmap croppedImage =
                WhitespaceCropper.CropWhitespace(
                    NoiseCleaner.RemoveNoiseWithBorder(
                        BorderRemoval.RemoveBorder(img)));

            if (EmptyImageDetector.IsImageEmpty(croppedImage))
            {
                return(new None <GradeDigest>());
            }
            else
            {
                return(new Some <GradeDigest>(
                           GradeDigest.FromImage(
                               DigestExtractor.ExtractDigestImage(croppedImage))));
            }
        }
Exemple #4
0
 public static Bitmap RemoveNoiseWithBorder(Bitmap src)
 {
     return(RemoveNoise(BorderRemoval.RemoveRemainingBorder(RemoveNoise(src))));
 }