懒人精灵-百度OCR

[复制链接]
查看4635 | 回复20 | 2021-8-16 14:43:55 | 显示全部楼层 |阅读模式
  1. function 百度OCR(API_Key,Secret_Key,x,y,x1,y1,pic_name)
  2. -- 懒人精灵版本:3.5.1以上
  3. -- 使用百度云OCR识别文字信息,适用于局部范围
  4. -- 默认是截取手机显示屏幕图片进行保存,按需求截取图片范围
  5. -- 百度OCR(百度云文字识别应用的API_Key秘钥,百度云文字识别应用的Secret_Key,左上角x坐标,左上角y坐标,右下角x1坐标,右下角y1坐标,图片名称)
  6. --  获取本地图片的路径
  7. local path = "/mnt/sdcard/"..pic_name..".png"
  8. -- 截取指定的图片大小并保存path路径
  9. snapShot(path,x,y,x1,y1)
  10. -- 使用bdOcr函数参数 图片路径 百度API_Key,Secret_Key
  11. local ret = bdOcr(path,API_Key,Secret_Key)
  12. -- print("bdocr:",ret)
  13. -- print(type(ret))
  14. local res = jsonLib.decode(ret)
  15. -- print(res.words_result)
  16. --[===[for k,v in pairs(res.words_result) do
  17. -- print('获取的文字数据',v.words)
  18.         print(res.words_result[1]['words'])
  19. end]===]
  20.    
  21. return res.words_result[1]['words']
  22. end

  23. local ocr_str = 百度OCR("API_Key","Secret_Key",15,532,217,703,'test')

  24. print(ocr_str)

复制代码


回复

使用道具 举报

qq99989680 | 2021-8-16 14:50:31 | 显示全部楼层
支持 支持

多来点综合性流程控制的  让俺学习借鉴一下
回复

使用道具 举报

xywl | 2021-8-16 14:51:01 | 显示全部楼层
继续发干货
回复

使用道具 举报

懒人最帅群员 | 2021-8-16 14:54:12 | 显示全部楼层
我来了
回复

使用道具 举报

懒人最帅群员 | 2021-8-16 14:54:32 | 显示全部楼层
怎么增加积分
回复

使用道具 举报

1974199655 | 2021-8-16 15:06:33 | 显示全部楼层
干货分享
回复

使用道具 举报

001 | 2021-8-16 15:32:58 | 显示全部楼层
感谢分享!!!
回复

使用道具 举报

905407220 | 2021-8-16 15:58:41 | 显示全部楼层

感谢分享!!!
回复

使用道具 举报

yh4132990 | 2021-8-18 12:10:30 | 显示全部楼层
干货干货干货
回复

使用道具 举报

lcm2022 | 2021-11-22 13:16:03 | 显示全部楼层
学习了。。。。。。。。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则