Computer Vision - Congnitive Service - Unable to upload file

Mooseheads_vik 1 Reputation point
2022-12-30T06:30:04.69+00:00

I am exploring OCR and pretty new to this stuff. I have uploaded hand written text to the Azure storage container :

const printedTextSampleURL = 'https://rflabsocrstorage.blob.core.windows.net/newcontainer/test.jpeg';

When I execute the sample program given at https://learn.microsoft.com/en-us/azure/cognitive-services/computer-vision/quickstarts-sdk/client-library?tabs=visual-studio&pivots=programming-language-javascript

I get the following error. Can someone please help me on this?

status: 400  

},
body: {
error: {
code: 'BadArgument',
message: 'Bad or unrecognizable request JSON or binary file.'
}
}
}

Azure Computer Vision
Azure Computer Vision
An Azure artificial intelligence service that analyzes content in images and video.
179 questions
Azure Cognitive Services
Azure Cognitive Services
A group of Azure artificial intelligence services and cognitive APIs that help build intelligent apps.
946 questions
{count} votes

1 answer

Sort by: Most helpful
  1. romungi-MSFT 27,196 Reputation points Microsoft Employee
    2022-12-30T09:13:05.137+00:00

    @Mooseheads_vik I have tried to your file and the complete error message indicates the following`.

    body: {"error":{"code":"InvalidImage","message":"The file submitted couldn't be parsed. This can be due to one of the following reasons: the file format is not supported ( Supported formats include JPEG, PNG, BMP, PDF and TIFF), the file is corrupted or password protected."}},  
    headers: HttpHeaders { _headersMap: [Object] },  
    status: 400  
    

    I think this is because your URL or image is not publicly accessible in the storage container that is used. Please try to open up the image for anonymous access or provide a URL that can be accessible to public internet so the requested posted to the service can read your image and provide a response.

    For example, the same quickstart with this image URL works to provide a valid response.

    https://raw.githubusercontent.com/Azure-Samples/cognitive-services-sample-data-files/master/ComputerVision/Images/printed_text.jpg

    Response:
    274977-image.png

    If an answer is helpful, please click on 130616-image.png or upvote 130671-image.png which might help other community members reading this thread.

    No comments