示例代码:
import ddddocrdet = ddddocr.DdddOcr(det=False,ocr=True,show_ad=False)with open('target.png','rb') as f: target_bytes = f.read()with open(bg_origin,'rb') as f: background_bytes = f.read()res = det.slide_match(target_bytes,background_bytes,simple_target=True)value = res['target'][0]
target.png就是滑块的图片:
bg_origin就是原图(切记是没有缺口的):
识别结果示例:
注意:ddddocr库比较大,一些托管网站对于 serveless Function 的大小有做限制!!!!