var _gApiLoaded = new Promise(function(resolve) {
jQuery.sap.includeScript("https://apis.google.com/js/api.js", "gapi", function() {
gapi.load("client", function() {
gapi.client.setApiKey("<Insert your key here>");
resolve();
});
});
}); // https://www.googleapis.com/auth/cloud-platform
_gApiLoaded.then(function() {
// https://developers.google.com/discovery/v1/reference/apis/list Just hit execute to get a list
gapi.client.load("https://vision.googleapis.com/$discovery/rest", "v1", function() {
var reader = new FileReader();
reader.readAsDataURL(oBlob);
reader.onloadend = function() {
var base64data = reader.result;
gapi.client.vision.images.annotate({
"requests": [{
"features": [{
"type": "TEXT_DETECTION"
}],
"image": {
"content": base64data.replace(/^data:image\/jpeg;base64,/, "")
}
}]
}).then(function(oResponse) {
console.log({
"ImageBase64": base64data,
"OCRResult": oResponse.result
});
});
};
});
});
{
"responses": [
{
"textAnnotations": [
{
"locale": "en",
"description": "Incentergy\nGmbH\nManuel Blechschmidt\nCEO\nwww.incentergy.de\nPhone: +49 173 632 26 21\nMail: manuel.blechschmidt@incentergy.de\n",
"boundingPoly": {
"vertices": [
{
"x": 42,
"y": 151
},
{
"x": 901,
"y": 151
},
{
"x": 901,
"y": 661
},
{
"x": 42,
"y": 661
}
]
}
},
{
"description": "Incentergy", ...
{
"entities": [
{
"name": "CEO",
"type": "PERSON",
"metadata": {},
"salience": 0.3584892,
"mentions": [
{
"text": {
"content": "CEO",
"beginOffset": 36
},
"type": "COMMON"
}
]
},
{
"name": "Phone",
"type": "CONSUMER_GOOD",
"metadata": {},
"salience": 0.2520285,
"mentions": [
{
"text": {
"content": "Phone",
"beginOffset": 58
},
"type": "COMMON"
}
]
},
{
"name": "Incentergy GmbH Manuel Blechschmidt",
"type": "PERSON",
"metadata": {},
"salience": 0.22339708,
"mentions": [
{
"text": {
"content": "Incentergy\nGmbH\nManuel Blechschmidt",
"beginOffset": 0
},
"type": "PROPER"
}
]
}, ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
9 | |
7 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |