what-the-bank/sources/com/kofax/mobile/sdk/m/e.java

79 lines
2.3 KiB
Java

package com.kofax.mobile.sdk.m;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.kofax.android.abc.image_classification.ResultPair;
import com.kofax.kmc.ken.engines.data.Image;
import com.kofax.kmc.kut.utilities.error.ErrorInfo;
import com.kofax.kmc.kut.utilities.error.KmcRuntimeException;
import com.kofax.mobile.sdk._internal.g;
import java.util.List;
import o.InterfaceC13391fZD;
/* loaded from: classes3.dex */
public class e implements com.kofax.mobile.sdk.c.c {
private final com.kofax.mobile.sdk.c.b Hi;
private final g wM;
/* JADX INFO: Access modifiers changed from: package-private */
@InterfaceC13391fZD
public e(com.kofax.mobile.sdk.c.b bVar, g gVar) {
this.Hi = bVar;
this.wM = gVar;
}
@Override // com.kofax.mobile.sdk.c.c
public com.kofax.mobile.sdk.c.a a(String str, Image image) {
synchronized (this) {
List<ResultPair> c = c(str, image);
p(c);
ResultPair resultPair = c.get(0);
if (resultPair.confidence <= BitmapDescriptorFactory.HUE_RED && !q(c)) {
return null;
}
return new a(this, resultPair);
}
}
/* loaded from: classes3.dex */
class a implements com.kofax.mobile.sdk.c.a {
private final float Hj;
final e Hk;
private final String ah;
a(e eVar, ResultPair resultPair) {
this.Hk = eVar;
this.ah = resultPair.classID;
this.Hj = resultPair.confidence;
}
@Override // com.kofax.mobile.sdk.c.a
public float getConfidence() {
return this.Hj;
}
@Override // com.kofax.mobile.sdk.c.a
public String getClassId() {
return this.ah;
}
}
private List<ResultPair> c(String str, Image image) {
g.a w = this.wM.w(image);
try {
return this.Hi.a(str, w.getBitmap(), 2);
} finally {
w.be();
}
}
private void p(List<ResultPair> list) {
if (list == null || list.size() <= 0) {
throw new KmcRuntimeException(ErrorInfo.KMC_CL_INVALID_IMAGE_SUPPLIED);
}
}
private static boolean q(List<ResultPair> list) {
return list.size() >= 2 && list.get(0).confidence - list.get(1).confidence > 0.2f;
}
}