Modes for backgroundRemoval and foregroundMatting cannot work, hit error 401

YQ 45 Reputation points

Hi, I would like to ask Remove the background from images with REST API how to run it successfully? I pasted the REST API URL into my Postman, I used one random dog image URL as data to test. The result from Postman, I got is error 404. FYI, I tried with SouthEast Asia and East US regions' Computer Vision resource group, both resource groups gave me same error messages. I also tried on mode=foregroundMatting, also showed me same error 401.

User's image

User's image

Kindly advise on this issue. Thank you.

Azure Computer Vision
Azure Computer Vision
An Azure artificial intelligence service that analyzes content in images and video.
323 questions
Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
2,444 questions
{count} votes

Accepted answer
  1. romungi-MSFT 42,761 Reputation points Microsoft Employee

    @YQ Did you pass the Headers along with your request? The following headers should be passed along with the request to authenticate the request. Since the error message indicates authorization error, I think these headers could be missing/incorrect.

    Ocp-Apim-Subscription-Key: <Your_Key>

    Content-Type: application/json

    Here is a request that I used with the image you have shared, and the response is seen without the background. My resource is created in eastus.

    User's image

    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    0 comments No comments

0 additional answers

Sort by: Most helpful