【问题标题】:using microsoft ocr computer vision api使用微软 ocr 计算机视觉 api
【发布时间】:2016-06-25 09:58:44
【问题描述】:

我的 node.js 网络应用正在使用微软的 ocr 计算机视觉 api

https://www.microsoft.com/cognitive-services/en-us/computer-vision-api

当我将静态链接传递给 api 时,它可以工作

喜欢:

正文:“{'url':'LINK_TO_IMAGE'}”,

这是请求回调的一部分。

我想要的是动态传递链接。

让回调函数被变量链接

我试过用这个:

正文:{'url':链接},

但这不起作用,没有响应。

我应该遵循其他格式吗?

【问题讨论】:

    标签: node.js api ocr


    【解决方案1】:

    看文档,这里https://dev.projectoxford.ai/docs/services/54ef139a49c3f70a50e79b7d/operations/5527970549c3f723cc5363e4

    <!DOCTYPE html>
    <html>
    <head>
        <title>JSSample</title>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
    </head>
    <body>
    
    <script type="text/javascript">
        $(function() {
            var params = {
                // Request parameters
                "language": "unk",
                "detectOrientation ": "true",
            };
    
            $.ajax({
                url: "https://api.projectoxford.ai/vision/v1/ocr?" + $.param(params),
                beforeSend: function(xhrObj){
                    // Request headers
                    xhrObj.setRequestHeader("Content-Type","application/json");
                    xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key","{subscription key}");
                },
                type: "POST",
                // Request body
                data: "{body}",
            })
            .done(function(data) {
                alert("success");
            })
            .fail(function() {
                alert("error");
            });
        });
    </script>
    </body>
    </html>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-09-16
      • 1970-01-01
      • 2023-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-04
      相关资源
      最近更新 更多