Пример #1
0
        public static CodeRecognitionResult FromException(Exception ex)
        {
            CodeRecognitionResult result = new CodeRecognitionResult()
            {
                SuccessfullyProcessedImage = false,
                Exception = ex
            };

            return(result);
        }
Пример #2
0
        public static CodeRecognitionResult FromPrediction(ImagePrediction imagePrediction)
        {
            CodeRecognitionResult result = new CodeRecognitionResult();

            if (imagePrediction == null)
            {
                result.SuccessfullyProcessedImage = false;
            }
            else
            {
                result.SuccessfullyProcessedImage = true;
                result.PredictionScore            = imagePrediction.Score.Max();
                result.PredictedLabel             = imagePrediction.PredictedLabelValue;
            }

            return(result);
        }
Пример #3
0
        public CodeRecognitionResult Recognize(ImageData imageData)
        {
            if (!CanProcessImage)
            {
                return(null);
            }

            ImagePrediction imagePrediction;

            try
            {
                imagePrediction = _predictionEngine.Predict(imageData);
            }
            catch (Exception ex)
            {
                return(CodeRecognitionResult.FromException(ex));
            }

            return(CodeRecognitionResult.FromPrediction(imagePrediction));
        }