NODE-百度AI OCR识别

福尔摩斯对我笑 2019-01-25 36085 次 10506条

申请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
未来博客 博主大人
到了这个年纪,不应该再彷徨!

发表评论



 


已有 10506 条评论 1


  1. kevin durant shoes

    I definitely wanted to develop a quick note to be able to say thanks to you for those splendid solutions you are posting here. My long internet look up has at the end been compensated with reputable suggestions to go over with my partners. I would declare that many of us website visitors are extremely lucky to be in a very good site with very many special people with helpful hints. I feel really blessed to have discovered your webpages and look forward to many more exciting moments reading here. Thanks a lot once more for all the details.

    回复 2019年10月29日
  2. nike air vapormax

    I am also commenting to make you know of the excellent experience my child gained browsing your web site. She figured out many pieces, not to mention how it is like to possess a great helping mood to let many more with no trouble gain knowledge of chosen complicated things. You truly did more than readers’ expectations. Many thanks for coming up with such precious, healthy, edifying and as well as cool thoughts on the topic to Sandra.

    回复 2019年10月28日
  3. kobe basketball shoes

    Needed to post you that very small word just to give many thanks the moment again for the stunning views you’ve featured on this page. It has been so tremendously open-handed of people like you to supply freely precisely what a lot of people might have supplied as an e-book in making some profit on their own, and in particular since you could possibly have tried it if you ever decided. The basics additionally worked like a easy way to know that someone else have a similar passion the same as mine to grasp somewhat more with reference to this problem. Certainly there are a lot more pleasant periods up front for folks who take a look at your blog.

    回复 2019年10月28日
  4. jordan 11

    I simply wanted to thank you very much again. I do not know what I might have done in the absence of the entire creative concepts contributed by you on such a theme. It truly was the frustrating setting for me, but spending time with a new well-written avenue you treated that took me to jump with delight. I will be grateful for the information and thus wish you know what a powerful job you have been providing instructing men and women with the aid of a blog. Probably you haven’t got to know all of us.

    回复 2019年10月28日
  5. kate spade outlet

    I intended to create you a tiny remark so as to say thank you over again relating to the remarkable opinions you’ve featured above. It’s so pretty open-handed with people like you to deliver unhampered all numerous people could have marketed as an e-book to end up making some money on their own, most notably now that you could have done it if you desired. These inspiring ideas also acted like the great way to know that other people online have similar zeal the same as my personal own to see way more on the topic of this matter. I know there are thousands of more pleasurable occasions in the future for individuals that find out your blog post.

    回复 2019年10月28日
  6. offwhite

    I intended to draft you the very small remark to help thank you very much as before considering the nice information you have contributed on this website. This is tremendously open-handed of people like you to convey openly what a few individuals might have sold as an electronic book to earn some cash on their own, certainly now that you could possibly have tried it in case you decided. The creative ideas likewise acted to be a good way to fully grasp the rest have a similar interest just as my very own to know more and more in respect of this problem. I believe there are several more pleasurable moments up front for people who looked over your blog.

    回复 2019年10月28日
  7. nike air max shoes

    I definitely wanted to make a comment in order to express gratitude to you for some of the remarkable tricks you are writing at this website. My time-consuming internet lookup has at the end been honored with excellent facts and strategies to talk about with my partners. I would state that that we site visitors actually are undoubtedly blessed to exist in a superb website with so many awesome professionals with beneficial pointers. I feel rather grateful to have encountered your weblog and look forward to so many more cool times reading here. Thank you once again for all the details.

    回复 2019年10月27日
  8. louboutin

    My spouse and i got quite satisfied Michael managed to finish off his basic research out of the ideas he had through the web page. It’s not at all simplistic just to be giving for free tips which often others may have been trying to sell. So we consider we have the blog owner to appreciate for that. The main explanations you’ve made, the easy blog menu, the friendships your site make it easier to instill – it is all extraordinary, and it’s helping our son in addition to our family feel that that situation is cool, and that is tremendously serious. Thank you for all the pieces!

    回复 2019年10月27日
  9. coach factory outlet

    I simply wanted to type a word to be able to express gratitude to you for some of the nice items you are placing on this site. My time-consuming internet search has at the end been rewarded with brilliant facts and techniques to write about with my close friends. I ‘d state that that most of us website visitors actually are unequivocally fortunate to be in a perfect network with so many awesome individuals with valuable hints. I feel truly lucky to have encountered your website page and look forward to tons of more pleasurable times reading here. Thanks once more for all the details.

    回复 2019年10月27日
  10. hermes bags

    I in addition to my pals were actually studying the great solutions from the website then all of the sudden got a horrible feeling I had not thanked the site owner for those strategies. Those men ended up as a result excited to read through them and already have really been making the most of those things. Thank you for turning out to be quite kind and for using variety of ideal subject matter millions of individuals are really wanting to learn about. My sincere apologies for not saying thanks to you earlier.

    回复 2019年10月26日
  11. nike cortez women

    Thank you so much for giving everyone a very spectacular possiblity to read critical reviews from this blog. It can be very terrific plus jam-packed with fun for me and my office colleagues to visit your web site at the very least 3 times every week to read through the newest issues you will have. Not to mention, I’m always satisfied with your cool creative concepts served by you. Selected two facts on this page are essentially the best we have had.

    回复 2019年10月26日
  12. coach handbags

    I would like to voice my respect for your kind-heartedness for persons that must have help with your concept. Your very own dedication to getting the message up and down has been really helpful and have surely made women like me to realize their desired goals. Your own interesting key points signifies a great deal a person like me and even more to my office colleagues. Many thanks; from all of us.

    回复 2019年10月26日
  13. yeezy boost 350 v2

    Thanks so much for providing individuals with an extraordinarily special possiblity to read articles and blog posts from this website. It is usually very beneficial plus packed with a good time for me personally and my office friends to search your web site more than three times a week to read through the newest stuff you have got. And lastly, I’m always pleased concerning the spectacular points you give. Some 2 points in this post are unequivocally the simplest I’ve ever had.

    回复 2019年10月25日
  14. nhl jerseys

    Thanks for your whole labor on this web page. Debby takes pleasure in carrying out investigation and it’s really easy to see why. Most of us hear all about the powerful medium you offer important ideas on your website and cause participation from website visitors on this topic while our favorite child is without question understanding a great deal. Take advantage of the rest of the new year. You are performing a really good job.

    回复 2019年10月25日
  15. kyrie shoes

    I and also my pals appeared to be reading the good ideas located on your web blog and so all of the sudden developed a terrible suspicion I had not thanked the blog owner for those techniques. All of the women came absolutely happy to read all of them and already have absolutely been having fun with those things. I appreciate you for getting so accommodating and then for figuring out this sort of really good tips most people are really eager to learn about. Our honest apologies for not expressing appreciation to you sooner.

    回复 2019年10月25日
  16. fila shoes

    Thanks a lot for providing individuals with a very splendid opportunity to read critical reviews from this blog. It’s usually so amazing plus full of fun for me personally and my office fellow workers to search your website no less than three times in one week to see the latest guidance you have got. Not to mention, I am always happy with all the cool advice served by you. Some 1 ideas in this article are particularly the best we have had.

    回复 2019年10月25日
  17. paul george shoes

    I wanted to post you this very small observation to be able to thank you as before for these splendid principles you have shared in this article. It is certainly unbelievably generous of people like you to deliver freely just what a lot of folks could have distributed for an e-book to help with making some money on their own, especially considering the fact that you might have tried it if you decided. The solutions additionally worked to provide a easy way to fully grasp that some people have the identical passion really like my very own to realize way more with respect to this problem. I know there are several more fun opportunities up front for individuals who browse through your blog.

    回复 2019年10月24日
  18. ferragamo belts

    My spouse and i felt so fulfilled Emmanuel could finish off his investigations with the precious recommendations he received in your blog. It is now and again perplexing just to possibly be making a gift of key points that some others have been making money from. And we all do understand we have the blog owner to be grateful to for that. The entire explanations you’ve made, the easy website navigation, the relationships you make it possible to create – it’s all impressive, and it is letting our son and the family imagine that the subject is enjoyable, which is quite important. Thanks for everything!

    回复 2019年10月24日
  19. yeezy boost 500

    My spouse and i have been very delighted Louis managed to conclude his basic research from the ideas he had when using the web page. It is now and again perplexing to simply possibly be making a gift of instructions which usually some other people could have been selling. Therefore we see we have got you to give thanks to because of that. The specific explanations you’ve made, the simple web site navigation, the friendships you help instill – it’s got many overwhelming, and it’s assisting our son in addition to the family do think this theme is brilliant, which is certainly very important. Thank you for all the pieces!

    回复 2019年10月24日
  20. hermes belt

    I wanted to put you this very small observation to be able to thank you yet again for those amazing tactics you have featured here. It has been really shockingly open-handed of you to provide extensively just what a lot of people could have supplied as an ebook to earn some dough for themselves, particularly considering the fact that you might well have tried it if you ever desired. These techniques in addition served to be the easy way to fully grasp that other people have the same zeal similar to my own to realize a whole lot more with regards to this problem. I am certain there are some more pleasurable periods in the future for individuals that take a look at your blog post.

    回复 2019年10月24日
  21. canada goose

    I wanted to compose a small note in order to thank you for all of the unique advice you are showing at this site. My extensive internet investigation has at the end of the day been honored with incredibly good points to talk about with my friends. I ‘d tell you that we visitors are quite fortunate to live in a remarkable network with so many marvellous people with very beneficial secrets. I feel quite privileged to have discovered the site and look forward to really more excellent moments reading here. Thank you again for everything.

    回复 2019年10月23日
  22. fila shoes

    Thanks so much for giving everyone an exceptionally remarkable chance to read articles and blog posts from this blog. It’s usually so terrific and jam-packed with a lot of fun for me and my office fellow workers to search your website at a minimum three times in a week to see the fresh things you have got. And of course, I’m also at all times impressed for the special points you serve. Selected two areas in this article are completely the most efficient we have ever had.

    回复 2019年10月23日
  23. jordans

    I want to convey my passion for your kind-heartedness giving support to those individuals that need help with this particular situation. Your very own dedication to passing the message around came to be certainly effective and has enabled associates just like me to get to their endeavors. The warm and friendly guide entails a whole lot to me and especially to my mates. Warm regards; from each one of us.

    回复 2019年10月22日
  24. birkin bag

    I have to show thanks to this writer just for bailing me out of this crisis. Right after exploring through the world wide web and coming across advice which were not pleasant, I thought my entire life was gone. Existing devoid of the answers to the problems you have resolved all through the write-up is a critical case, and those that could have badly affected my entire career if I had not come across your website. Your actual understanding and kindness in dealing with almost everything was helpful. I am not sure what I would’ve done if I had not come upon such a stuff like this. I’m able to at this point look ahead to my future. Thanks so much for the skilled and effective guide. I will not be reluctant to refer your web blog to anybody who should have care on this situation.

    回复 2019年10月21日
  25. jordan retro

    Needed to draft you a very small note to finally say thanks as before for your extraordinary suggestions you have documented on this page. It has been open-handed with you to offer unhampered just what many people could possibly have supplied for an electronic book in order to make some bucks for their own end, primarily since you might have done it if you ever decided. Those strategies likewise worked to become easy way to be certain that many people have the same dream just as my very own to find out a lot more when it comes to this matter. I believe there are some more pleasurable instances ahead for folks who scan through your blog.

    回复 2019年10月19日
  26. supreme clothing

    I precisely needed to say thanks once again. I’m not certain the things that I would’ve undertaken without these creative concepts documented by you on this field. It was a very difficult scenario in my position, nevertheless looking at a skilled fashion you dealt with it forced me to leap over fulfillment. Now i’m thankful for your service and in addition wish you comprehend what a powerful job that you are providing instructing the rest all through your blog post. I know that you haven’t come across all of us.

    回复 2019年10月19日
  27. cheap nfl jerseys china

    Thanks a lot for providing individuals with an extraordinarily memorable possiblity to read in detail from this site. It’s always very kind plus full of a good time for me personally and my office peers to visit the blog on the least 3 times weekly to see the fresh items you will have. And of course, I am also usually happy concerning the very good inspiring ideas served by you. Selected 3 areas in this article are definitely the most suitable I’ve ever had.

    回复 2019年10月18日
  28. fila

    I wish to show appreciation to this writer for bailing me out of such a trouble. Just after checking through the online world and seeing principles which were not helpful, I thought my entire life was over. Living devoid of the approaches to the problems you have solved by means of your main post is a critical case, as well as those which may have in a wrong way damaged my entire career if I had not come across the website. Your competence and kindness in playing with a lot of stuff was priceless. I don’t know what I would’ve done if I hadn’t discovered such a thing like this. I can also at this point look ahead to my future. Thanks so much for your expert and effective help. I won’t be reluctant to refer your web page to any person who desires assistance about this area.

    回复 2019年10月17日
  29. curry shoes

    I want to show my thanks to you just for bailing me out of this particular situation. Right after looking through the internet and seeing strategies which were not helpful, I figured my entire life was done. Existing devoid of the approaches to the issues you have fixed through your main short post is a critical case, and the ones which might have adversely damaged my entire career if I hadn’t noticed your blog post. Your main knowledge and kindness in dealing with a lot of things was very helpful. I am not sure what I would have done if I hadn’t come across such a solution like this. I’m able to at this time look forward to my future. Thank you so much for your skilled and sensible help. I will not be reluctant to refer your web page to any person who ought to have guidance about this problem.

    回复 2019年10月16日
  30. curry 6

    Thanks a lot for providing individuals with an exceptionally splendid chance to read from this blog. It really is so amazing and as well , packed with amusement for me and my office fellow workers to search your web site particularly thrice a week to find out the newest stuff you have. And definitely, we are certainly satisfied with the tremendous tactics you serve. Certain 1 points in this article are in fact the simplest we’ve ever had.

    回复 2019年10月15日
  31. yeezy boost 350 v2

    I as well as my guys came taking note of the excellent suggestions found on the blog and so unexpectedly developed a terrible feeling I never expressed respect to the blog owner for those secrets. Most of the boys are actually totally excited to read through them and now have honestly been using these things. We appreciate you genuinely considerably accommodating and also for having certain marvelous subject areas millions of individuals are really eager to understand about. Our own honest regret for not expressing gratitude to sooner.

    回复 2019年10月14日
  32. jordans

    I happen to be writing to let you know what a perfect encounter our daughter developed going through your web site. She figured out a wide variety of issues, most notably what it’s like to have an awesome giving character to get the rest quite simply comprehend selected complicated topics. You really exceeded readers’ desires. Many thanks for rendering those essential, healthy, explanatory and even unique thoughts on your topic to Emily.

    回复 2019年10月13日
  33. golden goose sneakers

    A lot of thanks for every one of your work on this web page. Ellie enjoys carrying out investigations and it’s easy to understand why. Most of us know all relating to the powerful method you make efficient items by means of this web site and therefore improve response from visitors about this theme then our favorite child is undoubtedly understanding a whole lot. Take pleasure in the remaining portion of the new year. You’re carrying out a wonderful job.

    回复 2019年10月12日
  34. longchamp

    Thanks so much for giving everyone an extraordinarily splendid possiblity to read in detail from this website. It is often very superb and as well , packed with fun for me and my office peers to visit your website no less than thrice in 7 days to see the new things you will have. And definitely, I’m so usually astounded with the exceptional suggestions served by you. Selected 1 ideas in this article are easily the most effective we have had.

    回复 2019年10月11日
  35. kyrie 3

    I just wanted to develop a quick note in order to thank you for these lovely advice you are giving here. My time consuming internet investigation has finally been rewarded with good quality knowledge to share with my co-workers. I ‘d mention that most of us site visitors are unquestionably fortunate to be in a remarkable community with many outstanding professionals with very beneficial tips and hints. I feel very much lucky to have seen your web pages and look forward to so many more fun moments reading here. Thanks again for all the details.

    回复 2019年10月10日
  36. yeezy boost 350 v2

    My husband and i ended up being really excited Chris could finish up his investigation from the ideas he obtained from your very own web page. It is now and again perplexing to just choose to be freely giving ideas which usually some others have been trying to sell. And we also remember we have got the writer to thank because of that. The explanations you made, the simple website menu, the friendships you will make it possible to promote – it’s got many amazing, and it’s facilitating our son in addition to the family consider that that topic is brilliant, which is extraordinarily serious. Thank you for all the pieces!

    回复 2019年10月9日
  37. kyrie irving shoes

    I and also my buddies ended up examining the nice procedures found on your site and so the sudden I had an awful feeling I never thanked the blog owner for those secrets. These young boys had been for this reason thrilled to learn them and have in effect absolutely been taking advantage of those things. Appreciate your truly being really thoughtful and for deciding on such useful tips most people are really needing to discover. My personal sincere regret for not expressing appreciation to earlier.

    回复 2019年10月9日
  38. adidas tubular

    I’m also commenting to make you be aware of what a cool encounter my princess had going through your webblog. She noticed several pieces, which included what it’s like to possess an ideal coaching nature to make many more without difficulty learn certain tricky matters. You undoubtedly did more than visitors’ expectations. I appreciate you for showing such insightful, trustworthy, educational not to mention cool thoughts on that topic to Gloria.

    回复 2019年10月8日
  39. 奥巴马

    写的还可以

    回复 2019年4月4日
  40. 好好

    回复 2019年3月19日
  41. 陈先生

    能分享源码吗

    回复 2019年3月16日
  42. jie

    6666

    回复 2019年3月14日
  43. 白子

    路过~我买的酸酸菌#^_^#
    发现一枚技术大佬啊~

    回复 2019年3月7日
  44. 1

    厉害

    回复 2019年3月6日
  45. 秦兽兽

    哪里来的模板呢

    回复 2019年3月6日