title: Extract Text from an image using Google Cloud Vision API using cv2 in python
body: <p>We are trying to extract the text from an image using google-cloud-vision API:</p>
  
  <pre><code>import io
  import os
  from google.oauth2 import service_account
  from google.cloud import vision
  
  # The name of the image file to annotate (Change the line below 'image_path.jpg' ******)
  path = os.path.join(os.path.dirname(__file__), '3.jpg') # Your image path from current directory 
  
  
  client = vision.ImageAnnotatorClient()
  
  with io.open(path, 'rb') as image_file:
      content = image_file.read()
  
  image = vision.types.Image(content=content)
  
  response = client.text_detection(image=image)
  texts = response.text_annotations
  print('Texts:')
  
  for text in texts:
      print(format(text.description))
  </code></pre>
  
  <p>In this code, we need to make the API read the image through the 'cv2' function only, instead of using the 'io' function:</p>
  
  <pre><code># Read image file
      with io.open(img_path, 'rb') as image_file:
          content = image_file.read()
  </code></pre>
  
  <p>Any suggestion will be helpful</p>