|
- if (!requestScreenCapture()) {
- alert('请求截图权限失败,请先获取截图权限!');
- engines.stopAll();
- }
- var img_yzm= className("android.widget.Image").findOne();
- var bounds_yzm = img_yzm.bounds();
- setText([1],OCR_yzm(bounds_yzm.left,bounds_yzm.top,img_yzm));
- function OCR_yzm(left,top,view) {
- view.click();
- sleep(1000);
- while(!captureScreen("/sdcard/1.png"));
- var src = images.read("/sdcard/1.png");
- var clip = images.clip(src, left,top, 210, 113);
- let useSlim = true
- const stringList = paddle.ocrText(clip, useSlim)
- toastLog(JSON.stringify(stringList))
- src.recycle();
- return(JSON.stringify(stringList).split('["')[1].split('"]')[0]);
- }
复制代码
|
|