//Test OCR private void Button_Click(object sender, RoutedEventArgs e) { try { if (OrigImage.Image == null) { return; } var bmp = LoadBmp(); var output = blockOcr.GetOcr(bmp, engineComboBox.SelectedItem.ToString() .ToEnum(EngineMode.Default), pageSegComboBox.SelectedItem.ToString() .ToEnum(PageSegMode.SingleLine), GetSettings().EvaluateMathOCR); ProcImage.Image = blockOcr.ProcessedImage; resultOcrTextbox.Text = string.Empty; output.ToList().ForEach(o => resultOcrTextbox.Text += o + "\n"); resultOcrTextbox.Text = resultOcrTextbox.Text.TrimEnd('\n'); ocrRateTextblock.Text = "OCR Rate: " + blockOcr.OcrRate + "%"; } catch (Exception ex) { MessageBox.Show(ex.Message, "ERROR"); } }
public override void Process(BotData data) { base.Process(data); var blockOcr = new BlockOcr(); using (var captcha = Decaptcha(blockOcr, data)) { using (var pix = PixConverter.ToPix(captcha.ConvertPixelFormat(System.Drawing.Imaging.PixelFormat.Format24bppRgb))) { InsertVariable(data, false, blockOcr.GetOcr(data, pix).First(), InputVariableName); } } }