示例#1
0
        private void OnClassifyDrawing(object sender, EventArgs e)
        {
            try
            {
                _loggingService.Log("Classify drawing has started");

                var imagePreprocessor = new ImagePreprocessor();

                double[] pixels = imagePreprocessor.Preprocess(_drawingView.Drawing);

                IPredictionModel predictionModel = Global.PredictionModel;

                double[] prediction = predictionModel.Predict(pixels);

                _drawingView.ProcessPrediction(prediction);

                _loggingService.Log("Classify drawing has completed");
            }
            catch (Exception exception)
            {
                _loggingService.Log(exception);

                _messageService.ShowMessage("An error ocurred while classyfing the drawing. Please try again.", "Classification error", icon: MessageBoxIcon.Information);
            }
        }