本帖最后由 flk100207 于 2021-11-30 18:19 编辑
local tick = tickCount()
snapShot("/storage/emulated/0/test.png",0,0,720,1280)
local b64 = getFileBase64("/storage/emulated/0/test.png")
b64 = 类_字符串.uft8字符转URL编码(b64)
b64=httpPost("https://aip.baidubce.com/rest/2.0/ocr/v1/accurate_basic?access_token=24.013a64e3e007fda91f102cf8f6c8a9c3.2592000.1640690211.282335-11278949&aipSdk=Android&aipSdkVersion=1_4_4&aipDevid=c0852d69-9910-4dd5-92ae-ec4fab9cb549","Content-Type=application/x-www-form-urlencoded&image="..b64)
--print(b64)
b64 = splitStr(b64,":[")
local 数组={}
if #b64 >= 2 then
b64 = splitStr(b64[2],"]")
if #b64 >= 2 then
b64 = splitStr(b64[1],"},{")
for pxwzs=1,#b64 do
pxt = string.match(b64[pxwzs], "words"..'":"'.."(.-)"..'"')
数组[pxwzs]=pxt
end
end
end
print(tickCount()-tick)
print(数组)
|