TextDetector textDetector = new TextDetector( this);
Frame frame = new Frame();
frame.setBitmap(bitmap);
JSONObject jsonResult = textDetector.detect(frame, null);
{
"resultCode": 0,
"common_text": "{\"blocks\":
[{\
"boundingBox\":{\"height\":
33,
\"left\":592,\"top\":857,\"width\":140},
\
"cornerPoints\":[{\"x\":592,\"y\":857},
{\
"x\":732,\"y\":857},{\"x\":592,\"y\":890},
{\
"x\":732,\"y\":890}],
\
"probability\":0.77,\"value\":\"返程日期\"},
{\
"boundingBox\":
{\
"height\":33,\"left\":650,\"top\":924,\"width\":141},
\
"cornerPoints\":[{\"x\":650,\"y\":924},
{\
"x\":791,\"y\":924},{\"x\":650,
\
"y\":957},{\"x\":791,\"y\":957}],
\
"probability\":0.75,\"value\":\"添加返程\"},
{\
"boundingBox\":
{\
"height\":45,\"left\":430,\"top\":1938,\"width\":232},
\
"cornerPoints\":
[{\
"x\":430,\"y\":1938},{\"x\":662,\"y\":1938},
{\
"x\":430,\"y\":1983},{\"x\":662,\"y\":1983}],
\
"probability\":0.7,\"value\":\"国 我的订单\"},
{\
"boundingBox\":
{\
"height\":46,\"left\":757,\"top\":2077,\"width\":46},
\
"cornerPoints\":
[{\
"x\":757,\"y\":2077},{\"x\":803,\"y\":2077},
{\
"x\":757,\"y\":2123},{\"x\":803,\"y\":2123}],
\
"probability\":0.72,\"value\":\"口\"}],
\
"cornerPoints\":[{\"x\":430,\"y\":857},
{\
"x\":803,\"y\":857},{\"x\":430,\"y\":2123},
{\
"x\":803,\"y\":2123}],\"probability\":0.735,
\
"textRect\":{\"height\":1266,\"left\":430,
\
"top\":857,\"width\":373},\"value\":
\
"返程日期\\n添加返程\\n国 我的订单\\n口\"}"
}
可以的,在detect()方法中会默认启动引擎,如果引擎已经启动则不会再次启动,开发者可以放心使用。
当前,手机截屏OCR支持对中英文的识别。聚焦拍照OCR支持中文、英文、德语、法语、意大利语、西班牙语,以及葡萄牙语,并将在短期内开放对日语、韩语,以及俄语的支持,具体开放日期请关注相关开发文档。