title: Python OCR Text from Image
body: <p><br>
  I want to extract data from a scanned passaport image.<br>
  I am using PIL for the image manipulating process and pytesseract to convert the image into text.<br>
  My problem is that i dont get what i need..I get 5 instead of S ..and things like this.<br>
  I think the problem is not with pytesseract , but with PIL , because i`m not filtering the image very good.<br>
  Can somebody help me to extract from an image , only the black pixels?<br>
  Or if can anybody help me with an advice on what fiters can i use to get best results.
  Thank you!
  I was trying this:</p>
  
  <pre><code>#!/usr/bin/python
  # -*- coding: utf-8 -*-
  import pytesseract
  import requests
  from PIL import Image
  from PIL import ImageFilter
  from StringIO import StringIO
  
  def process_image(url):
      image = _get_image(url)
      image = image.filter(ImageFilter.SHARPEN)
  #    image = image.convert('1')
      print pytesseract.image_to_string(image)
  
  def _get_image(url):
      return Image.open(StringIO(requests.get(url).content))
  
  process_image('https://upload.wikimedia.org/wikipedia/commons/3/3f/Polish_passport_biodata_page.png')
  </code></pre>