Computer Vision API – Detect Objects

The “Detect” operation detects objects in the uploaded image and return the co-ordinates associated with the objects along with the confidence score for each object.

API referencehttps://bit.ly/2lPQeoV

Pre-requisites

  • Computer Vision service or Cognitive Services provisioned on Azure
  • Postman App

Image Requirements

  • Supported image formats: JPEG, PNG, GIF, BMP.
  • Image file size must be less than 4MB.
  • Image dimensions must be between 50 x 50 and 4200 x 4200 pixels, and the image cannot be larger than 10 megapixels.

Detect Objects Operation

  • Launch Postman
  • Append your endpoint URL from pre-requisites step with /vision/2.0/detect
  • Provide the subscription key and content-type in Headers tab
  • Provide the image URL in the Body tab.
  • Following image is provided in the blob URL
  • Here is the output from the API endpoint highlighting the co-ordinates of the detected objects.
 {
    "objects": [
        {
            "rectangle": {
                "x": 20,
                "y": 139,
                "w": 426,
                "h": 361
            },
            "object": "person",
            "confidence": 0.722
        }
    ],
    "requestId": "2fa01070-2e8e-4615-891a-6962f6c7ffdf",
    "metadata": {
        "width": 674,
        "height": 500,
        "format": "Jpeg"
    }
} 
  • If you map the co-ordinates over the image it will be displayed as shown below.
  • If you upload an image with multiple objects as shown below it will detect all the objects in the image.
  • Computer Vision classifies and detect objects based on the list of 86 categories as shown below.

Leave a Reply

Your email address will not be published. Required fields are marked *