Android视觉OCR;安卓视觉
已经在github链接上查看了Android OCR vision示例 您如何能够自动识别和选择信用卡号码,而不必费力地点击它。 当前的接收检测方法是Android视觉OCR;安卓视觉,android,ocr,android-vision,Android,Ocr,Android Vision,已经在github链接上查看了Android OCR vision示例 您如何能够自动识别和选择信用卡号码,而不必费力地点击它。 当前的接收检测方法是 @Override public void receiveDetections(Detector.Detections<TextBlock> detections) { mGraphicOverlay.clear(); SparseArray<TextBlock> items = detections.ge
@Override
public void receiveDetections(Detector.Detections<TextBlock> detections) {
mGraphicOverlay.clear();
SparseArray<TextBlock> items = detections.getDetectedItems();
for (int i = 0; i < items.size(); ++i) {
TextBlock item = items.valueAt(i);
if (item != null && item.getValue() != null) {
Log.d("Processor", "Text detected! " + item.getValue());
}
OcrGraphic graphic = new OcrGraphic(mGraphicOverlay, item);
mGraphicOverlay.add(graphic);
}
}
@Override
public void release() {
mGraphicOverlay.clear();
}
@覆盖
公共空隙接收检测(检测器。检测){
mGraphicOverlay.clear();
SparseArray items=detections.getDetectedItems();
对于(int i=0;i
我想找到一种方法,在扫描时自动识别有效的信用卡号码(可以是收据号码、票据订单号码),并切换到另一个具有该值的意图,以便使用它执行其他活动 您可以使用正则表达式来匹配它检测到的每一行文本。如果您的信用卡号码与regex匹配,请按照您的意愿进一步操作。不需要触摸 你可以试试这个正则表达式(取自) 用下面的方法
@Override
public void receiveDetections(Detector.Detections<TextBlock> detections) {
mGraphicOverlay.clear();
SparseArray<TextBlock> items = detections.getDetectedItems();
for (int i = 0; i < items.size(); ++i) {
TextBlock item = items.valueAt(i);
if (item != null && item.getValue() != null) {
List<Line> textComponents = (List<Line>) item.getComponents();
for (Line currentText : textComponents) {
String text = currentText.getValue();
if (word.matches(CREDIT_CARD_PATTERN){
do your stuff here...
}
}
}
}
OcrGraphic graphic = new OcrGraphic(mGraphicOverlay, item);
mGraphicOverlay.add(graphic);
}
}
@覆盖
公共空隙接收检测(检测器。检测){
mGraphicOverlay.clear();
SparseArray items=detections.getDetectedItems();
对于(int i=0;i
您好,虽然这不是您问题的解决方案。但为什么不使用呢?我正在尝试创建一个应用程序来帮助您解决OCR问题
@Override
public void receiveDetections(Detector.Detections<TextBlock> detections) {
mGraphicOverlay.clear();
SparseArray<TextBlock> items = detections.getDetectedItems();
for (int i = 0; i < items.size(); ++i) {
TextBlock item = items.valueAt(i);
if (item != null && item.getValue() != null) {
List<Line> textComponents = (List<Line>) item.getComponents();
for (Line currentText : textComponents) {
String text = currentText.getValue();
if (word.matches(CREDIT_CARD_PATTERN){
do your stuff here...
}
}
}
}
OcrGraphic graphic = new OcrGraphic(mGraphicOverlay, item);
mGraphicOverlay.add(graphic);
}
}