skip to Main Content

as my question mention it, how do i need to change this statement to send an image in base64 to Azure?

curl -H "Ocp-Apim-Subscription-Key: ***hidden***" "https://***hidden***.cognitiveservices.azure.com/face/v1.0/detect?detectionModel=detection_03&returnFaceId=true&returnFaceLandmarks=false" 
-H "Content-Type: application/json" --data-ascii "{"url":"https://upload.wikimedia.org/wikipedia/commons/c/c3/RH_Louise_Lillian_Gish.jpg"}"

Thank you!

2

Answers


  1. Chosen as BEST ANSWER

    curl -X POST "https://.cognitiveservices.azure.com/face/v1.0/detect" -H "Content-Type: application/octet-stream" -H "Ocp-Apim-Subscription-Key: 27e993*********6aaa2464" --data-binary @'/home/rafael/Downloads/person.jpg'

    is the solution that works. As far as I can tell, the documentation seems outdated.


  2. how do i need to change this statement to send an image in base64 to Azure?

    As per this documentation, your curl command seems fine.

    Alternatively, you can try as suggested by muru:

    '{"image" : "'"$( base64 ~/Pictures/1.jpg)"'"}
    

    Updated answer:

    As per Use the Face client library:

    curl -v -X POST "https://westus.api.cognitive.microsoft.com/face/v1.0/detect?returnFaceId=true&returnFaceLandmarks=false&returnFaceAttributes={string}&recognitionModel=recognition_04&returnRecognitionModel=false&detectionModel=detection_03&faceIdTimeToLive=86400" -H "Content-Type: application/json" -H "Ocp-Apim-Subscription-Key: {subscription key}" --data-ascii "{"url":"https://csdx.blob.core.windows.net/resources/Face/Images/identification1.jpg"}"
    

    You can refer to similar issues: can’t send/request base64 to azure face api with python and Face API need support for base64 string or Local File URL or Native File URL instead of Image URL

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search