title: Invoice / OCR: Detect two important points in invoice image
body: <p>I am currently working on OCR software and my idea is to use templates to try to recognize data inside invoices.</p>
  
  <p>However scanned invoices can have several 'flaws' with them:</p>
  
  <ul>
  <li>Not all invoices, based on a single template, are correctly aligned under the scanner.</li>
  <li>People can write on invoices</li>
  <li>etc.</li>
  </ul>
  
  <p>Example of invoice: (Have to google it, sadly cannot add a more concrete version as client data is confidential obviously)</p>
  
  <p><img src="https://i.stack.imgur.com/ouxqq.gif" alt="Example invoice"></p>
  
  <p>I find my data in the invoices based on the x-values of the text.</p>
  
  <p>However I need to know the scale of the invoice and the offset from left/right, before I can do any real calculations with all data that I have retrieved.</p>
  
  <p>What have I tried so far?</p>
  
  <p>1) Making the image monochrome and use the left and right bounds of the first appearance of a black pixel. This fails due to the fact that people can write on invoices.</p>
  
  <p>2) Divide the invoice up in vertical sections, use the sections that have the highest amount of black pixels. Fails due to the fact that the distribution is not always uniform amongst similar templates.</p>
  
  <p>I could really use your help on (1) how to identify important points in invoices and (2) on what I should focus as the important points.</p>
  
  <p>I hope the question is clear enough as it is quite hard to explain.</p>