title: Read data from an Azure blob container into the Computer Vision service
body: <p>I'm using the Azure CV module to process images, so far I have only used local images or images freely available on the web. But now I need to use the images I have stored in a storage account container.</p>
  <p>I don't see how to do this in the documentation, E.G: this code allow to use local images:</p>
  <pre><code>import os
  import sys
  import requests
  # If you are using a Jupyter notebook, uncomment the following line.
  # %matplotlib inline
  import matplotlib.pyplot as plt
  from PIL import Image
  from io import BytesIO
  
  # Add your Computer Vision subscription key and endpoint to your environment variables.
  if 'COMPUTER_VISION_SUBSCRIPTION_KEY' in os.environ:
      subscription_key = os.environ['COMPUTER_VISION_SUBSCRIPTION_KEY']
  else:
      print(&quot;\nSet the COMPUTER_VISION_SUBSCRIPTION_KEY environment variable.\n**Restart your shell or IDE for changes to take effect.**&quot;)
      sys.exit()
  
  if 'COMPUTER_VISION_ENDPOINT' in os.environ:
      endpoint = os.environ['COMPUTER_VISION_ENDPOINT']
  
  analyze_url = endpoint + &quot;vision/v3.0/analyze&quot;
  
  # Set image_path to the local path of an image that you want to analyze.
  # Sample images are here, if needed:
  # https://github.com/Azure-Samples/cognitive-services-sample-data-files/tree/master/ComputerVision/Images
  image_path = &quot;C:/Documents/ImageToAnalyze.jpg&quot;
  
  # Read the image into a byte array
  image_data = open(image_path, &quot;rb&quot;).read()
  headers = {'Ocp-Apim-Subscription-Key': subscription_key,
             'Content-Type': 'application/octet-stream'}
  params = {'visualFeatures': 'Categories,Description,Color'}
  response = requests.post(
      analyze_url, headers=headers, params=params, data=image_data)
  response.raise_for_status()
  
  # The 'analysis' object contains various fields that describe the image. The most
  # relevant caption for the image is obtained from the 'description' property.
  analysis = response.json()
  print(analysis)
  image_caption = analysis[&quot;description&quot;][&quot;captions&quot;][0][&quot;text&quot;].capitalize()
  
  # Display the image and overlay it with the caption.
  image = Image.open(BytesIO(image_data))
  plt.imshow(image)
  plt.axis(&quot;off&quot;)
  _ = plt.title(image_caption, size=&quot;x-large&quot;, y=-0.1)
  plt.show()
  </code></pre>
  <p>This other to use images from the web:</p>
  <pre><code>computervision_client = ComputerVisionClient(endpoint, CognitiveServicesCredentials(subscription_key))
  
  remote_image_url = &quot;https://raw.githubusercontent.com/Azure-Samples/cognitive-services-sample-data-files/master/ComputerVision/Images/landmark.jpg&quot;
  
  
  '''
  Describe an Image - remote
  This example describes the contents of an image with the confidence score.
  '''
  print(&quot;===== Describe an image - remote =====&quot;)
  # Call API
  description_results = computervision_client.describe_image(remote_image_url )
  
  # Get the captions (descriptions) from the response, with confidence level
  print(&quot;Description of remote image: &quot;)
  if (len(description_results.captions) == 0):
      print(&quot;No description detected.&quot;)
  else:
      for caption in description_results.captions:
          print(&quot;'{}' with confidence {:.2f}%&quot;.format(caption.text, caption.confidence * 100))
  </code></pre>
  <p>And this other to read data from a storage container:</p>
  <pre><code>from azure.storage.blob import BlobClient
  
  blob = BlobClient.from_connection_string(conn_str=&quot;my_connection_string&quot;, container_name=&quot;my_container&quot;, blob_name=&quot;my_blob&quot;)
  
  with open(&quot;./BlockDestination.txt&quot;, &quot;wb&quot;) as my_blob:
      blob_data = blob.download_blob()
      blob_data.readinto(my_blob)
  </code></pre>
  <p>But I don't see how to make the connection between the storage container and the CV service</p>