方法介绍
命令功能: 将Json字符串转换成数组
语法格式: 类_Json.解Json格式(str)
参数:
str:json字符串
返回值: 返回数组
local paddle = require("libpaddleocr")
require("懒人综合插件")
print("脚本开始",paddle.ocr)
local path = getWorkPath()
extractAssets("paddle.rc",path,"*")
print(path)
for i=1,100 do
local image = "/mnt/sdcard/test.png"
snapShot(image,275,74,451,129)
local begintm = tickCount()
local ret = paddle.ocr(path,image)
local endtm =tickCount()
print("结果:",ret,"耗时:",(endtm - begintm).."毫秒")
local list=类_Json.解Json格式(ret)
if #list.words_result==0 then
return nil
end
--print(#list.words_result)
print(list.words_result_num)
print(list.words_result[1].words)
print(list.words_result[1].pos)
print(list.words_result[1].score)
end