NODE-百度AI OCR识别

福尔摩斯对我笑 2019-01-25 9151 次 1870条

申请KEY,下载SDK,安装baidu-aip-sdk模块;详细文档地址及KEY申请地址 http://ai.baidu.com/docs#/Auth/top

var AipOcrClient = require("baidu-aip-sdk").ocr;

// 设置APPID/AK/SK
var APP_;
var API_KEY = "your key";
var SECRET_KEY = "you secret_key";

// 新建一个对象,建议只保存一个对象调用服务接口
var client = new AipOcrClient(APP_ID, API_KEY, SECRET_KEY);

// console.log(client)


var fs = require('fs');

var image = fs.readFileSync("2.jpg").toString("base64");

// 调用通用文字识别(高精度版)
client.accurateBasic(image).then(function(result) {
    console.log(JSON.stringify(result));
}).catch(function(err) {
    // 如果发生网络错误
    console.log(err);
});


// 如果有可选参数
// var options = {};
// options["detect_direction"] = "true";
// options["probability"] = "true";

// // 带参数调用通用文字识别(高精度版) 识别更为精准,当然,耗时也长一点
// client.accurateBasic(image, options).then(function(result) {
//     console.log(JSON.stringify(result));
// }).catch(function(err) {
//     // 如果发生网络错误
//     console.log(err);
// });;
var AipOcrClient = require("baidu-aip-sdk").ocr;

// 设置APPID/AK/SK
var APP_;
var API_KEY = "XMYKiMOFM3LBkXf4OUcT0nYc";
var SECRET_KEY = "2RiBlgFhpGWty590LFbLlAwqPX4itRBN";

// 新建一个对象,建议只保存一个对象调用服务接口
var client = new AipOcrClient(APP_ID, API_KEY, SECRET_KEY);

// console.log(client)


var fs = require('fs');

var image = fs.readFileSync("2.jpg").toString("base64");

// 调用通用文字识别, 图片参数为本地图片
client.generalBasic(image).then(function(result) {
    console.log(JSON.stringify(result));
}).catch(function(err) {
    // 如果发生网络错误
    console.log(err);
});

// // 如果有可选参数
// var options = {};
// var options = {};
// options["language_type"] = "CHN_ENG";
// options["detect_direction"] = "true";
// options["detect_language"] = "true";
// options["probability"] = "true";

// // 带参数调用通用文字识别, 图片参数为本地图片
// client.generalBasic(image, options).then(function(result) {
//     console.log(JSON.stringify(result));
// }).catch(function(err) {
//     // 如果发生网络错误
//     console.log(err);
// });;

// var url = "https//www.x.com/sample.jpg";

// // 调用通用文字识别, 图片参数为远程url图片
// client.generalBasicUrl(url).then(function(result) {
//     console.log(JSON.stringify(result));
// }).catch(function(err) {
//     // 如果发生网络错误
//     console.log(err);
// });

// // 如果有可选参数
// var options = {};
// options["language_type"] = "CHN_ENG";
// options["detect_direction"] = "true";
// options["detect_language"] = "true";
// options["probability"] = "true";

// // 带参数调用通用文字识别, 图片参数为远程url图片
// client.generalBasicUrl(url, options).then(function(result) {
//     console.log(JSON.stringify(result));
// }).catch(function(err) {
//     // 如果发生网络错误
//     console.log(err);
// });;
标签:

非特殊说明,本博所有文章均为博主原创。

头像也是LOGO
未来博客 博主大人
到了这个年纪,不应该再彷徨!

发表评论



 


已有 1870 条评论 1


  1. daftar akun sbobet terpercaya

    STOP THE PRIVATISATION – how can paying somebody to do a job for
    you be cheaper if you have to pay them and shareholders!!!
    It’s just NOT POSSIBLE!!!

    回复 2020年2月26日
  2. suck

    I was able to find good info from your content.

    回复 2020年2月26日
  3. tuantender.id

    Right here is the perfect site for everyone who would like to understand this topic. You understand a whole lot its almost tough to argue with you (not that I personally would want to…HaHa). You definitely put a brand new spin on a topic that has been written about for a long time. Great stuff, just wonderful!

    回复 2020年2月26日
  4. bitch

    I could not refrain from commenting. Exceptionally well written!

    回复 2020年2月26日
  5. air yeezy

    I would like to express my appreciation to this writer for rescuing me from such a condition. Just after exploring through the the web and coming across tricks which are not productive, I was thinking my entire life was well over. Living devoid of the answers to the issues you’ve solved as a result of the posting is a serious case, as well as those that could have negatively damaged my entire career if I had not encountered your site. Your competence and kindness in controlling a lot of things was useful. I am not sure what I would have done if I hadn’t encountered such a point like this. I can also at this moment look forward to my future. Thanks for your time very much for this high quality and amazing guide. I will not think twice to recommend your web page to any person who needs to have guidance on this matter.

    回复 2020年2月26日
  6. erection

    I’d like to thank you for the efforts you’ve put in penning this blog. I really hope to see the same high-grade blog posts by you later on as well. In truth, your creative writing abilities has inspired me to get my own blog now 😉

    回复 2020年2月26日
  7. pulseras budistas de piedras

    Yet another thing I would like to convey is that instead of trying to suit all your online degree classes on times that you finish off work (because most people are fatigued when they get back), try to find most of your lessons on the saturdays and sundays and only a few courses for weekdays, even if it means taking some time off your weekend. This pays off because on the week-ends, you will be far more rested along with concentrated for school work. Thanks for the different recommendations I have mastered from your website.

    回复 2020年2月26日
  8. Bicicletas de montaña

    I feel that is one of the so much important information for me. And i’m satisfied studying your article. But wanna observation on some general things, The website taste is ideal, the articles is actually excellent : D. Just right task, cheers

    回复 2020年2月26日
  9. reddit nba streams

    Hey there! This is kind of off topic but I need some help from an established blog. Is it hard to set up your own blog? I’m not very techincal but I can figure things out pretty fast. I’m thinking about setting up my own but I’m not sure where to start. Do you have any points or suggestions? Appreciate it

    回复 2020年2月26日
  10. This site

    Wonderful article! We are linking to this particularly great article on our site. Keep up the great writing.

    回复 2020年2月26日
  11. cock

    I love looking through a post that will make men and women think. Also, many thanks for allowing me to comment!

    回复 2020年2月26日
  12. black cock

    Very nice article. I certainly appreciate this website. Keep writing!

    回复 2020年2月26日
  13. joker123 terbaru

    อยากเล่นตามป๋า บอกพนักงานว่า สมัครเกมส์สล็อตออนไลน์คลิ๊กสมัครได้ที่นี่
    https://line.me/R/ti/p/@bwin99star

    回复 2020年2月26日
  14. erection

    Having read this I thought it was really enlightening. I appreciate you taking the time and energy to put this content together. I once again find myself personally spending a significant amount of time both reading and posting comments. But so what, it was still worth it!

    回复 2020年2月26日
  15. lesbian

    I’m extremely pleased to discover this web site. I wanted to thank you for your time for this particularly wonderful read!! I definitely really liked every bit of it and I have you book-marked to check out new information in your blog.

    回复 2020年2月26日
  16. Abbruch Abbruch

    After looking into a number of the blog articles on your site, I truly appreciate your way of writing a blog. I book-marked it to my bookmark webpage list and will be checking back soon. Please visit my website too and let me know your opinion.

    回复 2020年2月26日
  17. negro

    Great info. Lucky me I found your site by chance (stumbleupon). I’ve bookmarked it for later!

    回复 2020年2月26日
  18. fag

    Great site you’ve got here.. It’s difficult to find excellent writing like yours these days. I really appreciate people like you! Take care!!

    回复 2020年2月26日
  19. lesbians

    I have to thank you for the efforts you’ve put in penning this site. I am hoping to see the same high-grade content from you later on as well. In truth, your creative writing abilities has inspired me to get my very own site now 😉

    回复 2020年2月26日
  20. erection

    This is a really good tip especially to those fresh to the blogosphere. Short but very accurate info… Appreciate your sharing this one. A must read article!

    回复 2020年2月26日
  21. secrettantric.com

    Greate post. Keep writing such kind of info on your page.

    Im really impressed by your site.
    Hey there, You’ve done an incredible job. I will certainly digg it and for
    my part recommend to my friends. I am confident they’ll be benefited from
    this site.

    回复 2020年2月26日
  22. orgasim

    Can I simply just say what a comfort to discover someone who genuinely knows what they’re talking about online. You definitely realize how to bring a problem to light and make it important. More and more people need to look at this and understand this side of the story. I can’t believe you’re not more popular since you surely possess the gift.

    回复 2020年2月26日
  23. Acheter Des Écoutes Spotify

    It is actually a nice and helpful piece of info. I am satisfied that you simply shared this helpful info with us.
    Please keep us up to date like this. Thanks for sharing.

    回复 2020年2月26日
  24. 룰렛 게임

    I think that everything said was actually very reasonable. But, what about this?
    suppose you wrote a catchier post title? I ain’t saying your information is not good,
    however what if you added something that grabbed folk’s attention? I mean NODE-百度AI
    OCR识别 | 未来博客 is kinda boring. You should glance at
    Yahoo’s front page and watch how they create news headlines to
    grab people interested. You might add a video or a picture or two to get people interested about everything’ve written. Just my opinion, it could bring your blog a little livelier.

    回复 2020年2月26日
  25. https://jrbola.com

    If you want to grow your know-how just keep visiting this web page and be updated with
    the hottest gossip posted here.

    回复 2020年2月26日
  26. Gutter Repair Raleigh NC

    Hi, I do think this is an excellent web site. I stumbledupon it 😉 I will come back yet again since i have book-marked it. Money and freedom is the greatest way to change, may you be rich and continue to guide others.

    回复 2020年2月26日
  27. Fuck off

    Way cool! Some very valid points! I appreciate you writing this post and also the rest of the website is really good.

    回复 2020年2月26日
  28. pornography

    I used to be able to find good info from your blog articles.

    回复 2020年2月26日
  29. 샌즈카지노

    Other than this, HDMI is not affected by resolution,
    colour depth, or refresh charge of the signal. Ethernet compatibility was introduced with the unveiling of version 1.4. http://www.wknh.org/2020/01/19/haunted-charleston-south-carolina-2/

    回复 2020年2月25日
  30. 샌즈카지노

    Other than this, HDMI is not affected by resolution, colour depth, or refresh charge
    of the signal. Ethernet compatibility was introduced with the unveiling of version 1.4. http://www.wknh.org/2020/01/19/haunted-charleston-south-carolina-2/

    回复 2020年2月25日
  31. Lotto Jackpot

    There’s definately a great deal to learn about this topic. I like all of the points you have made.

    回复 2020年2月25日
  32. negro

    After I initially commented I seem to have clicked the -Notify me when new comments are added- checkbox and from now on each time a comment is added I recieve four emails with the same comment. Is there an easy method you can remove me from that service? Thank you!

    回复 2020年2月25日
  33. gook

    Having read this I thought it was really informative. I appreciate you taking the time and energy to put this short article together. I once again find myself spending way too much time both reading and leaving comments. But so what, it was still worth it!

    回复 2020年2月25日
  34. pornography

    Your style is so unique in comparison to other people I have read stuff from. Thank you for posting when you have the opportunity, Guess I’ll just bookmark this web site.

    回复 2020年2月25日
  35. a325 tc bolts

    Do you have a spam problem on this blog; I also am a blogger, and I was curious about your situation; we have developed some nice practices and we are looking to swap solutions with others, please shoot me an e-mail if interested.

    回复 2020年2月25日
  36. begoniaflowers.design.blog

    Hey there just wanted to give you a quick heads up and let you know a few of the pictures aren’t loading properly.
    I’m not sure why but I think its a linking issue.

    I’ve tried it in two different internet browsers and both
    show the same outcome.

    回复 2020年2月25日
  37. w88

    Incredible points. Outstanding arguments. Keep up the amazing work.

    回复 2020年2月25日
  38. Mem Lexus888 Online M Login

    Wow, awesome blog layout! How long have you been blogging for?
    you make blogging look easy. The overall look of your web site is excellent, as well as the content!

    回复 2020年2月25日
  39. hard core

    Very good blog post. I definitely appreciate this site. Keep writing!

    回复 2020年2月25日
  40. แทงบอลสเต็ปสด

    Appreciation to my father who informed me regarding this web site, this webpage
    is in fact amazing.

    回复 2020年2月25日
  41. Fayetteville NC

    This is a great tip especially to those fresh to the blogosphere. Brief but very precise info… Thank you for sharing this one. A must read article!

    回复 2020年2月25日
  42. http://onlineboxing.net/jforum/user/profile/31219.page

    Great post, you have pointed out some great points, I as well conceive this is a very wonderful website.

    回复 2020年2月25日
  43. f2280 tc bolts

    Hello, i read your blog occasionally and i own a similar one and i was just wondering if you get a lot of spam remarks? If so how do you stop it, any plugin or anything you can suggest? I get so much lately it’s driving me insane so any help is very much appreciated.

    回复 2020年2月25日
  44. cunt

    Hi, I do think this is a great blog. I stumbledupon it 😉 I am going to come back once again since I book-marked it. Money and freedom is the greatest way to change, may you be rich and continue to help other people.

    回复 2020年2月25日
  45. Garage Clean Out Raleigh NC

    This is a topic that is close to my heart… Thank you! Exactly where can I find the contact details for questions?

    回复 2020年2月25日
  46. slut

    After going over a handful of the blog articles on your website, I truly like your technique of blogging. I saved it to my bookmark website list and will be checking back in the near future. Please visit my website as well and let me know how you feel.

    回复 2020年2月25日
  47. burstyourbrand.com

    An outstanding share! I’ve just forwarded this onto a coworker who has been doing a little research on this.
    And he actually bought me breakfast because I stumbled upon it for him…

    lol. So let me reword this…. Thanks for the meal!!
    But yeah, thanx for spending time to talk about this matter here on your web page.

    回复 2020年2月25日