title: Optical Character Recognition using IronOCR in C#
body: <p>I am learning about OCR and trying to read some text from an image with a changing background.</p>
  <p>I am using a bitmap to take a screenshot and then feed it to IronOCR to recognize the characters in the image.</p>
  <pre><code>// Selecting the area where I capture the image
  Rectangle rectangle = new Rectangle();
  rectangle.X = 830;
  rectangle.Y = 980;
  rectangle.Width = 270;
  rectangle.Height = 100;
  Rectangle bounds = rectangle;
  using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))
  {
      bitmap.SetResolution(500, 500);
  
      using (Graphics g = Graphics.FromImage(bitmap))
      {
          g.CopyFromScreen(new Point(bounds.Left, bounds.Top), Point.Empty, bounds.Size);
      }
  
      // Save the image
      bitmap.Save(@&quot;testimages\1.tiff&quot;, ImageFormat.Tiff);
  }
  
  // Reading the characters
  var Ocr = new IronTesseract();
  using (var Input = new OcrInput(@&quot;testimages\1.tiff&quot;))
  {
      var Result = Ocr.Read(Input);
      Console.WriteLine(Result.Text);
  }
  </code></pre>
  <p>This is how the image looks like:
  <a href="https://i.stack.imgur.com/kXg2r.png" rel="nofollow noreferrer">IMAGE</a></p>
  <p>The background of the image changes a little bit, but the text stays the same. The text can be modified to more readable characters (for example instead of &quot;--SOME TEXT HERE --&quot; I could change it to &quot;X X X X X X X X X X&quot;). Any ideas on how I can improve on my OCR?</p>
  <p>My question is how can I improve this in code to make the OCR more reliable and is there anything in the capturing image process that could improve my results?</p>
  <p>Ultimately, my goal would be to uniquely determine this at least with 95% accuracy that this is the text that appeared.</p>
  <p>If I run this 5 times these are the outputs:</p>
  <p><strong>ATTEMPT 1:</strong></p>
  <p>) 3-‘§0ME’TEXT;}TERE --;</p>
  <p>P LW hl</p>
  <p><strong>ATTEMPT 2:</strong></p>
  <p>: SRR TS
  o ' A \</p>
  <p><strong>ATTEMPT 3:</strong></p>
  <p>L;.,Q{SOMEYEXT (]3]</p>
  <p>Ty</p>
  <p><strong>ATTEMPT 4:</strong></p>
  <p>‘GEE UG</p>
  <p><strong>ATTEMPT 5:</strong></p>
  <p>N TR</p>
  <ul>
  <li>2PV N f</li>
  </ul>