| 网站首页 | 业界新闻 | 小组 | 交易 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
共有 1431 人关注过本帖, 1 人收藏
标题:图片文字识别--已解决!
只看楼主 加入收藏
radiofan
Rank: 6Rank: 6
等 级:侠之大者
威 望:6
帖 子:378
专家分:495
注 册:2006-7-30
收藏
得分:0 
以下是引用bzdm在2020-7-7 20:07:21的发言:

楼主你好,能否给个事例


程序代码:
CLEAR

Http = CreateObject("MSXML2.XMLHttp")

Http.Open("Post","https://aip./oauth/2.0/token?grant_type=client_credentials&client_id=你的id&client_secret=你的secret",.F.)

Http.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded")

Http.Send()

lcReturn = Http.ResponseText

*从lcReturn中获取token

lcimage = Filetostr('发票.JPG')

lcimage1 = STRCONV(lcimage,13) 

Set Library To myfll

lcimage2 = URLEncode(lcimage1)  

Set Library To 

StrPost = 'access_token=获取的token' + '&image=' + lcimage2 + '&paragraph=true&probability=true'

Http.Open("Post","https://aip./rest/2.0/ocr/v1/vat_invoice",.F.)

Http.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded")

Http.Send(StrPost)
lcReturn = Http.ResponseText

*从lcReturn中获取你要的信息,比如发票金额等!
2021-03-18 07:58
radiofan
Rank: 6Rank: 6
等 级:侠之大者
威 望:6
帖 子:378
专家分:495
注 册:2006-7-30
收藏
得分:0 
以下是引用radiofan在2021-3-18 07:58:29的发言:



CLEAR

Http = CreateObject("MSXML2.XMLHttp")

Http.Open("Post","https://aip.你的id&client_secret=你的secret",.F.)

Http.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded")

Http.Send()

lcReturn = Http.ResponseText

*从lcReturn中获取token

lcimage = Filetostr('发票.JPG')

lcimage1 = STRCONV(lcimage,13)

Set Library To myfll

lcimage2 = URLEncode(lcimage1)  

Set Library To

StrPost = 'access_token=获取的token' + '&image=' + lcimage2 + '¶graph=true&probability=true'

Http.Open("Post","https://aip.,.F.)

Http.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded")

Http.Send(StrPost)
lcReturn = Http.ResponseText

*从lcReturn中获取你要的信息,比如发票金额等!


都有详细的api文档的。
2021-03-18 08:00
mstzl3322
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2021-3-12
收藏
得分:0 
回复 12楼 radiofan
谢谢大佬赐教
2021-03-19 15:23
radiofan
Rank: 6Rank: 6
等 级:侠之大者
威 望:6
帖 子:378
专家分:495
注 册:2006-7-30
收藏
得分:0 
以下是引用mstzl3322在2021-3-19 15:23:11的发言:

谢谢大佬赐教


不敢,互相学习!
2021-03-20 08:57
快速回复:图片文字识别--已解决!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.061722 second(s), 9 queries.
Copyright©2004-2021, BCCN.NET, All Rights Reserved