Computer Vision OCR can only be used with URL

Eche 21 Reputation points
2022-04-07T18:11:19.533+00:00

Can i use the Computer Vision cognitive services with javascript but instead of using an URL attached to an image, using an image that i upload from my pc.

Azure Computer Vision
Azure Computer Vision
An Azure artificial intelligence service that analyzes content in images and video.
347 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,645 questions
0 comments No comments
{count} votes

Accepted answer
  1. GiftA-MSFT 11,161 Reputation points
    2022-04-08T04:25:18.897+00:00

    Hi, thanks for reaching out. It seems you want to read using local image instead of image url. Yes, this can be done by specifying content-type as 'application/octet-stream' in the request header. For example:

    var request = require('request');  
    var options = {  
      'method': 'POST',  
      'url': 'https://westus.api.cognitive.microsoft.com/vision/v3.2/read/analyze',  
      'headers': {  
        'Ocp-Apim-Subscription-Key': 'enter-key-here',  
        'Content-Type': 'application/octet-stream'  
      },  
      body: "<file contents here>"  
      
    };  
    request(options, function (error, response) {  
      if (error) throw new Error(error);  
      console.log(response.body);  
    });  
    

    You may also find this thread helpful.

    ----------

    --please don't forget to Accept Answer if the reply is helpful. Thanks.--

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful