In this tutorial we will use Computer Vision service to analyze an image and determine the accent and dominant color and whether the image is black & white or colored.
Step 1. Create Computer Vision Service
Let’s start by creating the Computer Vision API service. To do so, head over to Azure portal, click on Create Resource link, select AI + Machine Learning, then Computer Vision, fill in the form and click on the Create button.
The Free pricing tier (F0) allows you to send to analyze up to 20 images/minute, so it’s more than enough for our example.
Step 2. Basics (Overview & Keys)
Next in order to use this service we need two things:
- the Endpoint Url which can be found in the overview blade and
- the subscription key in order to access our service
Step 3. Try the service
- in the query parameters section set the value for the key visualFeatures as Color, which allows you to determine the accent color, dominant color, and whether an image is black&white.
- in the headers section, set the value for Ocp-Apim-Subscription-Key to the subscription key found in the Keys blade of our service.
- in the Request body section specify, in json, the url of an image you want to analyze
and the response of our call would look like this:
"dominantColors": ["Black", "Green"],
You can read more about all the things you can do with Computer Vision API following this link