认知服务调用如何使用图片的DataURL

说明:

Data URL给了我们一种很巧妙的将图片“嵌入”到HTML中的方法。跟传统的用img标记将服务器上的图片引用到页面中的方式不一样,在Data URL协议中,图片被转换成base64编码的字符串形式,并存储在URL中,冠以mime-type。认知服务的Rest API调用中图片只支持传入图片公网URL或本地图片的二进制流数组,并不支持直接上传DataURL。本文中,我将介绍如何巧妙的将Data URL转化为图片的二进制流数组,进而实现Rest请求调用。


核心转换(将base64转换成二进制数组)

function dataURItoBlob(base64Data) {
var byteString;
if (base64Data.split(',')[0].indexOf('base64') >= 0)
byteString = atob(base64Data.split(',')[1]);
else
byteString = unescape(base64Data.split(',')[1]);
var mimeString = base64Data.split(',')[0].split(':')[1].split(';')[0];
var ia = new Uint8Array(byteString.length);
for (var i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}
return new Blob([ia], {type:mimeString});
}

完整示例程序


本示例程序调用中国版认知服务的OCR功能。图片的URL直接使用DataURL,通过转码完成测试调用。


<html>
<head>
    <title>OCR using Project Oxford in javascript</title>
    <script src="https://yunewstoragetest.blob.core.chinacloudapi.cn/jslib/jquery-2.2.2.min.js"></script>
</head>                         

<body>
    <div>
        <label for="filename">OCR Test</label>
        <br />
        <button id="btn">Detect faces</button>
    </div>
    <div>
        <p id="response"></p>
    </div>
    <div>
        <canvas id="myCanvas" width="1000" height="800">
            Your browser does not support the HTML5 canvas tag.
        </canvas>
    </div>
<script>

//DataURL
var dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOYAAAAyCAYAAABIxaeCAAAgAElEQVR4Xoy9d3Mc6XU9fDp3T0IiSII555zJzbtaRctJP9tyzjn95XL5K7hc5VDOObyWnCTLsqSVVpK12l0ulznnCJAgiDh5pnO/dW5Pg8NZUjaqQAKD6fQ8N5577h3lxIkTCQAkifw3/6UoivzM/7Ofsz/2vrf3eL5fVdUnjus+JjtfHMfgdxRFT7yXx2bHP+1a3feT/f1p7+t+nuzv3c/VfQx/zp6VP3f/ztd5n9nf+XPv+bL3Z9fke7Pz8DVN0+T37Nju47N7yl7rXrvuc3TvRe/z8nce132O7ud42vuz88n14/SZs+fovi7PGyUxdF2Xa2T71r1GfK33vrO1yNbuCQHryFa3THXfe/f+d6939/p2yxGgduQ13cfs/lUV8+uSvj97Xyrf2e9JEslvvfLUfU/d1+59ll7d+E460yt3mZ49oX8nT55MniXUT2xc56juDXua4GcXedYm9QoulfJpwte9MU9Tqu7F/9+U8lmL2GuIMgHitfnFe5Ot6xiK7D4zQXnW+jxtobufsft+u5UyM2iZgHwn5X2WkPRueqY8meJkz9YthGI4lFThnqYo8jzaY0P7rGs8y5j2Gq3e/e7dn+w82R53r3fvmvD3dN9Sw6coqWJmRipTuOy5+b4n1y7da76vWymza3evU7dR773nXuP6LBnoXfdnyaZCxfxOgtu72L0WpddSZDf0NE/7tOs8y4P0ClC3de62Rk+zpk8T2v+LlXqagPxvXqfX0PzvCvPY2z656algZetHD9stmN1Go9vo0XikCpV69O7rPylImQBmnjGNhDIhjuPwiaipV0i7jVD337rX51l7/p0M5+Prp+vSfU+9Bqp7vTL5yBRTVfVONJJGX4/v5bGxyTzmk94sXReuX6qcj9ew9/pPf770/Lz+056z+5huw/4sOZl//dSpU99RMXtvptdj9m5S96L0eoNnGYDecz7N22bX6f1bFlb1hg7PCiV6X3/aPT3LKj9LCbPw7mkb90FDlm5k7+u05L1RQvdGdxuqbuP3+Fwf9HZPWvHU4z1+/seKmglm91o8Tch6jUW3J+xes+z+svM9S2C7n6M3CukNZbs9WPf5H4fVmTI+DmVThUnTscf396THTBUxWzsq52PF/OAePU7vHj9bGlV1e+JuOend02c5og883+nTp/9Pivk0T9mrlL3W+n9Tgu6b+b9ubK8FepZi9grH037vFhyGalnomuWDvb9nBqTbkPC9/A79zFKny9nrSbLNnxdS5UnPiSSz3OldPd5QRe4r+52WuVvh0utQONLzZSFcd+ia/Zy+NxOu1CPLdZUYMf6XHAuPcYOnGWce/yyPmb2ehcpPGoz0eTXlscfh3zMj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DNrt0b4nHQSTQxP18SR34U/FS6VzQVdDJYVEPommInWM7BJlHc097FI0WVBXLiY28yip4XO9lJpkw7qw139tBpOXwfMGR2RHynSbH3mPJbAaz3Ld37JIRUw5WBmMZN3CcbJT617NWYHqZTfNByusM5/59tviukM0990ypoQheMzJWpGuWTS9WzfHB+3xkcgggileFsNVO/zv1xeETsVcKY8jogpSDPLObuh4oozsyDJRBHSBcVdHVc8R1wpptPUBUwAmCjrlsEVM8el5/w3bekseQZKLrCz9lI4XYg0fx+fjz0FWW5fWrpUOFdan6+PdabA8pg0Bl+bJyjmvBIUZzxQ+87/Gf1m8pKy7IDuRtCfuzrHFCN5sfLGWDm+FEgt2CssbJzPSbhcCOW26nA5URVrWcVEx8FsEkX9OuE1AWeQE8T/9vc1ZieMLIq/4+CwZmUdlV1IEwFlNZwm/O2Mnim2A6T3NZvnmsLShtb/7hYmaGX7KVz+/Zqrm8+ke6/5+rpRz8x4OwMFfSb+pIuZIKZ5yKKmbHkfFRBixydroOWAk+tZte/gmO3M5EyG6koxqfblKOUCMRNwCZUQ0CeTCOcWLQfrAuxMvYVms+/EJLc4qTRijDYaNE5ft0hIbjEvkTWVZ23sUtx767d7SJ7W0BmZynbLuq0p5poQuVX7LN9u9S8az4Q/aTqjscuV08zlL8HG55DvOFCv8T8tshuqWXspK+JdArJbzCsd+b+KSYe+lnHU+KxiOmPWCPZZBZViJsr7JAUmjqizdYwD1JoSrj1zSynvAZ8L6K15zwQvldW9CG/X10C35rDGjzVX+9681yzPZ/m7pry5br6llJ/ta0aXbDdlN3knftxTTDcKCbD8/x9xpiUJb7uTKwAAAABJRU5ErkJggg==";

$('#btn').click(function () {
	showImage(dataURL);
    OCR(dataURL);
});


//base64 to [Binary image data]
function dataURItoBlob(base64Data) {
var byteString;
if (base64Data.split(',')[0].indexOf('base64') >= 0)
byteString = atob(base64Data.split(',')[1]);
else
byteString = unescape(base64Data.split(',')[1]);
var mimeString = base64Data.split(',')[0].split(':')[1].split(';')[0];
var ia = new Uint8Array(byteString.length);
for (var i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}
return new Blob([ia], {type:mimeString});
}

$("#filename").change(function () {
    showImage(dataURL);
});

function OCR(dataURL) {
    var apiKey = "<computer api key>";
	var blob = dataURItoBlob(dataURL); // dataurl to binary array

    // Call the API
    $.ajax({
        url: "https://api.cognitive.azure.cn/vision/v1.0/ocr?language=unk&detectOrientation=true",
        beforeSend: function (xhrObj) {
            xhrObj.setRequestHeader("Content-Type", "application/octet-stream");
            xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key", apiKey);
            $("#response").text("Calling api...");
        },
        type: "POST",
        data: blob,
        processData: false,
		//contentType: false
    })
        .done(function (response) {
            // Process the API response.
            processResult(response);
        })
        .fail(function (error) {
            // Oops, an error :(
            $("#response").text(error.getAllResponseHeaders());
        });
}

function processResult(response) {
    var arrayLength = response.length;

    if (arrayLength > 0) {
        var canvas = document.getElementById('myCanvas');
        var context = canvas.getContext('2d');

        context.beginPath();

        // Draw face rectangles into canvas.
        for (var i = 0; i < arrayLength; i++) {
            var faceRectangle = response[i].faceRectangle;
            context.rect(faceRectangle.left, faceRectangle.top, faceRectangle.width, faceRectangle.height);
        }

        context.lineWidth = 3;
        context.strokeStyle = 'red';
        context.stroke();
    }

    // Show the raw response.
    var data = JSON.stringify(response);
    $("#response").text(data);
}

function showImage(dataURL) {
    var canvas = document.getElementById("myCanvas");
    var context = canvas.getContext("2d");
    context.clearRect(0, 0, canvas.width, canvas.height);

    var input = document.getElementById("filename");
    var img = new Image;

    img.onload = function () {
        context.drawImage(img, 0, 0);
    }

	img.src = dataURL;
}

</script>
</body>
</html>

测试结果:

image

更多参考链接:

DATA URL简介及DATA URL的利弊

JavaScript将base64图片转换成formData并通过AJAX提交的实现方法

图片在线编码BASE64


posted @ 2017-12-18 15:47  taro_秋刀鱼  阅读(2820)  评论(0编辑  收藏  举报