コード例 #1
0
        private void ScanNewImage_Button_Click(object sender, EventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();

            open.Filter = "Image Files(*.jpeg;*.bmp;*.png;*.jpg)|*.jpeg;*.bmp;*.png;*.jpg";
            if (open.ShowDialog() == DialogResult.OK)
            {
                selectedFile      = open.FileName;
                pictureBox1.Image = new Bitmap(open.FileName);
            }

            string scannedText = ImageRecognition.GetTextFromImage(selectedFile);

            if (scannedText == null)
            {
                MessageBox.Show("Image is not valid!");
            }
            else
            {
                richTextBox1.Text = scannedText;
            }
        }
コード例 #2
0
 public Task <string> ScanImageAsync(Bitmap image) =>
 Task.Run(() => ImageRecognition.GetTextFromImage(image));
コード例 #3
0
 public Task <string> ScanImageAsync(string selectedFile) =>
 Task.Run(() => ImageRecognition.GetTextFromImage(imagePath: selectedFile));