毫秒级快速找字OCR识别文字API接口比肩百度AI

[复制链接]
查看5790 | 回复25 | 2021-11-23 00:02:41 | 显示全部楼层 |阅读模式
本帖最后由 flk100207 于 2021-12-24 14:06 编辑

function  识别原文字本地(IP地址,左,上,右,下,查找文字,是否点击,精准找字,语言,模式)
        --local b64 = 类_服务.识别原文字本地("http://110.40.196.160:5689",265,350,451,400)
        --local b64 = 类_服务.识别原文字本地("http://110.40.196.160:5689",265,350,451,400,"设置",true)
        --语言----日=japan  中=ch 韩=korean  英=en
        --模式----模式一=h  模式二=m
        if 语言 == nil or 语言 == 0 then 语言="ch" end
        if 查找文字 == "" or 查找文字 == 0 then 查找文字 = nil end
    if 模式 == nil or 模式 == 0 then 模式="m" end
        snapShot("/storage/emulated/0/test.png",左,上,右,下)
        local b64 = getFileBase64("/storage/emulated/0/test.png")
        b64 = encodeUrl(b64)
        local formStr = "img=" .. b64 .. "&lan=" .. 语言 .. "&model="..模式.."&rotate=0"
        b64 = httpPost(IP地址.."/report?",formStr)
        --print(b64)
        b64 = string.gsub(b64, "\n","")
        b64 = string.gsub(b64, " ","")
        b64 = string.gsub(b64, '","',"|")
        b64 = string.gsub(b64, '"',"")
        b64 = splitStr(b64,":[")
        local 数组={}
        local pxt,pxx,pxy
        if #b64 >= 2 then
                b64 = splitStr(b64[2],"]")
                if #b64 >= 2 then
                        b64 = splitStr(b64[1],"},{")
                        for pxwzs=1,#b64 do
                                --print(b64[pxwzs])
                                pxt = string.match(b64[pxwzs], "content:".."(.-)".."|")
                                if 查找文字 ~= nil then
                                        if 精准找字 then
                                                if pxt ==  查找文字 then
                                                        if 是否点击 then
                                                                pxx= string.match(b64[pxwzs], "ind_x1:".."(.-)".."|")
                                                                pxy= string.match(b64[pxwzs], "ind_y1:".."(.-)".."|")
                                                                pxx = splitStr(pxx,",")
                                                                pxy = splitStr(pxy,",")
                                                                tap(math.floor((tonumber(pxy[1])-tonumber(pxx[1]))/2+tonumber(pxx[1])+左),math.floor((tonumber(pxy[2])-tonumber(pxx[2]))/2+tonumber(pxx[2])+上))
                                                        end
                                                        return true
                                                end
                                        else
                                                if  string.find(pxt,查找文字) ~= nil then
                                                        if 是否点击 then
                                                                pxx= string.match(b64[pxwzs], "ind_x1:".."(.-)".."|")
                                                                pxy= string.match(b64[pxwzs], "ind_y1:".."(.-)".."|")
                                                                pxx = splitStr(pxx,",")
                                                                pxy = splitStr(pxy,",")
                                                                tap(math.floor((tonumber(pxy[1])-tonumber(pxx[1]))/2+tonumber(pxx[1])+左),math.floor((tonumber(pxy[2])-tonumber(pxx[2]))/2+tonumber(pxx[2])+上))
                                                        end
                                                        return true
                                                end
                                        end
                                else
                                        pxx= string.match(b64[pxwzs], "ind_x1:".."(.-)".."|")
                                        pxy= string.match(b64[pxwzs], "ind_y1:".."(.-)".."|")
                                        pxx = splitStr(pxx,",")
                                        pxy = splitStr(pxy,",")
                                        数组[pxwzs]={
                                        text = pxt ,
                                        l = tonumber(pxx[1])+左 ,
                                        t = tonumber(pxx[2])+上 ,
                                        r = tonumber(pxy[1])+左 ,
                                        b = tonumber(pxy[2])+上 ,
                                        x = math.floor((tonumber(pxy[1])-tonumber(pxx[1]))/2+tonumber(pxx[1])+左) ,
                                        y = math.floor((tonumber(pxy[2])-tonumber(pxx[2]))/2+tonumber(pxx[2])+上)
                                        }
                                end
                        end
                        if 查找文字 ~= nil then
                                return false
                        else
                                return  数组
                        end
                end
        end
end

local tick = tickCount()
aa=识别原文字本地("http://110.40.196.160:5678",0,0,720,1280)
if #aa >= 1 then
        print(aa)
        for v=1,#aa do
                print(aa[v])
        end
end
print("遍历速度:"..tickCount()-tick)

local tick = tickCount()
if 识别原文字本地("http://110.40.196.160:5689",0,0,720,1280,"脚本列表",true,true) then
        print("找到文字")
else
        print("没找到文字")
end
print("找字速度:"..tickCount()-tick)
--IP端口均为临时体验,如需服务端自行进群下载

点击链接加入群聊【OCR】:https://jq.qq.com/?_wv=1027&k=JfIHeBpJ


          只要有图灵

         生活就有希望
回复

使用道具 举报

肉肉爱破解 | 2021-11-23 10:36:28 | 显示全部楼层
感觉好厉害,备份下,
回复

使用道具 举报

cyc262 | 2021-11-24 09:28:42 | 显示全部楼层
学习学习,好牛逼的样子
好★天
好★天
学★向
习★
回复

使用道具 举报

cyc262 | 2021-11-24 09:47:46 | 显示全部楼层
attempt to get length of a nil value (global 'aa')
好★天
好★天
学★向
习★
回复

使用道具 举报

ca0111 | 2021-11-24 16:27:29 | 显示全部楼层
大佬 这个那里是不是有 点不对啊 post 提交之后 没返回啊 为print  不显示
回复

使用道具 举报

fogg | 2021-11-24 19:39:07 | 显示全部楼层
用不了0.0
免费写脚本,好项目免费写。要求你自己了解项目,拒绝上来就复制某某脚本。qq2605250162
回复

使用道具 举报

flk100207 | 2021-11-24 23:02:08 | 显示全部楼层

不可能不可能不可能不可能
          只要有图灵

         生活就有希望
回复

使用道具 举报

caocaonimima | 2021-11-25 00:13:48 | 显示全部楼层
哈哈哈用不了--
回复

使用道具 举报

tobo520 | 2021-11-30 11:19:13 | 显示全部楼层
支持支持支持
回复

使用道具 举报

ss0920 | 2021-11-30 20:50:53 | 显示全部楼层
不会用,先来学习
回复

使用道具 举报

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

本版积分规则

35

主题

72

帖子

436

积分

中级会员

Rank: 3Rank: 3

积分
436