75 lines
2.1 KiB
Java
75 lines
2.1 KiB
Java
package com.kofax.kmc.ken.engines.ocr;
|
|
|
|
import android.graphics.Rect;
|
|
import com.kofax.kmc.kut.utilities.error.ErrorInfo;
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public class OcrResultData {
|
|
String hS;
|
|
private ArrayList<OcrWord> hT;
|
|
String imageID;
|
|
ErrorInfo resultCode;
|
|
|
|
public String getText() {
|
|
ae();
|
|
if (this.hT == null) {
|
|
return null;
|
|
}
|
|
StringBuffer stringBuffer = new StringBuffer();
|
|
Iterator<OcrWord> it = this.hT.iterator();
|
|
while (it.hasNext()) {
|
|
OcrWord next = it.next();
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(next.getText());
|
|
sb.append(" ");
|
|
stringBuffer.append(sb.toString());
|
|
}
|
|
return stringBuffer.toString();
|
|
}
|
|
|
|
public OcrWord getWordAtPoint(int i, int i2) {
|
|
ae();
|
|
ArrayList<OcrWord> arrayList = this.hT;
|
|
if (arrayList == null) {
|
|
return null;
|
|
}
|
|
Iterator<OcrWord> it = arrayList.iterator();
|
|
while (it.hasNext()) {
|
|
OcrWord next = it.next();
|
|
if (new Rect(next.getX(), next.getY(), next.getX() + next.getWidth(), next.getY() + next.getHeight()).contains(i, i2)) {
|
|
return next;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public ArrayList<OcrWord> getWordsinRect(int i, int i2, int i3, int i4) {
|
|
ae();
|
|
if (this.hT == null) {
|
|
return null;
|
|
}
|
|
ArrayList<OcrWord> arrayList = new ArrayList<>();
|
|
Iterator<OcrWord> it = this.hT.iterator();
|
|
while (it.hasNext()) {
|
|
OcrWord next = it.next();
|
|
if (new Rect(i, i2, i3, i4).intersect(new Rect(next.getX(), next.getY(), next.getWidth() + next.getX(), next.getHeight() + next.getY()))) {
|
|
arrayList.add(next);
|
|
}
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
public ArrayList<OcrWord> getWords() {
|
|
ae();
|
|
return (ArrayList) this.hT.clone();
|
|
}
|
|
|
|
private void ae() {
|
|
if (this.hT == null) {
|
|
this.hT = (ArrayList) OcrEngine.ocrWords().clone();
|
|
}
|
|
}
|
|
}
|