147 lines
8.4 KiB
Java
147 lines
8.4 KiB
Java
|
package com.kofax.kmc.ken.engines;
|
||
|
|
||
|
import android.graphics.Bitmap;
|
||
|
import android.graphics.Point;
|
||
|
import android.graphics.Rect;
|
||
|
import com.kofax.android.abc.machine_vision.CaptureGuidance;
|
||
|
import com.kofax.android.abc.machine_vision.DocumentTracker;
|
||
|
import com.kofax.kmc.ken.engines.data.CheckDetectionResult;
|
||
|
import com.kofax.kmc.ken.engines.data.CheckDetectionSettings;
|
||
|
import com.kofax.kmc.ken.engines.data.CheckSide;
|
||
|
import com.kofax.kmc.ken.engines.data.HorizontalGuidance;
|
||
|
import com.kofax.kmc.ken.engines.data.OrientationGuidance;
|
||
|
import com.kofax.kmc.ken.engines.data.TurnGuidance;
|
||
|
import com.kofax.kmc.ken.engines.data.VerticalGuidance;
|
||
|
import com.kofax.kmc.ken.engines.data.ZoomGuidance;
|
||
|
import java.util.List;
|
||
|
import java.util.Locale;
|
||
|
|
||
|
/* loaded from: classes3.dex */
|
||
|
class h implements ICheckDetector {
|
||
|
private static final String TAG;
|
||
|
private static final int bD = 1;
|
||
|
private static int bE = 0;
|
||
|
private static final int bF = 30;
|
||
|
private final IBoundingRectCalculator T;
|
||
|
private final IOrientationGuidanceCalculator ae;
|
||
|
private final DocumentTracker bA = new DocumentTracker();
|
||
|
private Rect bB;
|
||
|
private CheckSide bC;
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public h() {
|
||
|
com.kofax.kmc.ken.engines.a aVar = new com.kofax.kmc.ken.engines.a();
|
||
|
this.T = aVar;
|
||
|
this.ae = new l(aVar);
|
||
|
this.bB = new Rect();
|
||
|
this.bC = CheckSide.NONE;
|
||
|
}
|
||
|
|
||
|
static {
|
||
|
System.loadLibrary("a1ac4");
|
||
|
System.loadLibrary("ee77d4");
|
||
|
System.loadLibrary("d8b3e6");
|
||
|
System.loadLibrary("b2681f");
|
||
|
TAG = "h";
|
||
|
bE = 0;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Can't rename method to resolve collision */
|
||
|
@Override // com.kofax.kmc.ken.engines.IDocumentDetector
|
||
|
public CheckDetectionResult detect(CheckDetectionSettings checkDetectionSettings, Bitmap bitmap) {
|
||
|
if (checkDetectionSettings.getSide() == CheckSide.NONE) {
|
||
|
return null;
|
||
|
}
|
||
|
return a(checkDetectionSettings, new com.kofax.mobile.sdk.o.d(bitmap));
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Can't rename method to resolve collision */
|
||
|
@Override // com.kofax.kmc.ken.engines.IDocumentDetector
|
||
|
public CheckDetectionResult detect(CheckDetectionSettings checkDetectionSettings, byte[] bArr, int i, int i2) {
|
||
|
return a(checkDetectionSettings, new com.kofax.mobile.sdk.o.e(bArr, 17, i, i2));
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.kmc.ken.engines.IDocumentDetector
|
||
|
public void destroy() {
|
||
|
this.bA.dispose();
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
/* JADX WARN: Removed duplicated region for block: B:19:0x0061 A[Catch: all -> 0x01b9, TRY_LEAVE, TryCatch #2 {, blocks: (B:10:0x002e, B:16:0x003d, B:17:0x0051, B:19:0x0061, B:23:0x006a, B:25:0x0078, B:27:0x0098, B:30:0x0084, B:32:0x008c, B:34:0x00a1, B:36:0x00b4, B:38:0x00ba, B:41:0x00c3, B:43:0x00cb, B:45:0x00d1, B:48:0x00da, B:50:0x00e4, B:52:0x00ec, B:54:0x00fa, B:57:0x0103, B:59:0x015e, B:61:0x0166, B:63:0x016e, B:65:0x0176, B:66:0x0180, B:68:0x0183, B:73:0x018f, B:75:0x0192, B:77:0x0196, B:80:0x019f, B:82:0x01a6, B:86:0x01af, B:92:0x004f, B:96:0x01b3, B:97:0x01b8, B:12:0x0031, B:15:0x0035, B:91:0x0048), top: B:9:0x002e, inners: #1 }] */
|
||
|
/* JADX WARN: Removed duplicated region for block: B:23:0x006a A[Catch: all -> 0x01b9, TRY_ENTER, TryCatch #2 {, blocks: (B:10:0x002e, B:16:0x003d, B:17:0x0051, B:19:0x0061, B:23:0x006a, B:25:0x0078, B:27:0x0098, B:30:0x0084, B:32:0x008c, B:34:0x00a1, B:36:0x00b4, B:38:0x00ba, B:41:0x00c3, B:43:0x00cb, B:45:0x00d1, B:48:0x00da, B:50:0x00e4, B:52:0x00ec, B:54:0x00fa, B:57:0x0103, B:59:0x015e, B:61:0x0166, B:63:0x016e, B:65:0x0176, B:66:0x0180, B:68:0x0183, B:73:0x018f, B:75:0x0192, B:77:0x0196, B:80:0x019f, B:82:0x01a6, B:86:0x01af, B:92:0x004f, B:96:0x01b3, B:97:0x01b8, B:12:0x0031, B:15:0x0035, B:91:0x0048), top: B:9:0x002e, inners: #1 }] */
|
||
|
/*
|
||
|
Code decompiled incorrectly, please refer to instructions dump.
|
||
|
To view partially-correct add '--show-bad-code' argument
|
||
|
*/
|
||
|
private com.kofax.kmc.ken.engines.h.a a(com.kofax.kmc.ken.engines.data.CheckDetectionSettings r21, com.kofax.mobile.sdk.o.f r22) {
|
||
|
/*
|
||
|
Method dump skipped, instructions count: 454
|
||
|
To view this dump add '--comments-level debug' option
|
||
|
*/
|
||
|
throw new UnsupportedOperationException("Method not decompiled: com.kofax.kmc.ken.engines.h.a(com.kofax.kmc.ken.engines.data.CheckDetectionSettings, com.kofax.mobile.sdk.o.f):com.kofax.kmc.ken.engines.h$a");
|
||
|
}
|
||
|
|
||
|
private void a(int i, int i2, CheckDetectionSettings checkDetectionSettings) {
|
||
|
Rect rect = new Rect(0, 0, i, i2);
|
||
|
CheckSide side = checkDetectionSettings.getSide();
|
||
|
if (rect.equals(this.bB) && side == this.bC) {
|
||
|
return;
|
||
|
}
|
||
|
this.bA.initializeString(a(side, side.equals(CheckSide.BACK) ? (float) checkDetectionSettings.getTargetFrameAspectRatio() : -1.0f), "DocumentTracker");
|
||
|
r();
|
||
|
this.bB = rect;
|
||
|
this.bC = side;
|
||
|
}
|
||
|
|
||
|
private void r() {
|
||
|
this.bA.reset();
|
||
|
this.bA.startup();
|
||
|
this.bA.RunDetection = true;
|
||
|
this.bA.RunLocalSearch = false;
|
||
|
this.bA.RunBoundaryDetection = true;
|
||
|
this.bA.RunDirectionDetection = true;
|
||
|
}
|
||
|
|
||
|
private static String a(CheckSide checkSide, float f) {
|
||
|
return String.format(Locale.US, "<?xml version='1.0' encoding='iso-8859-1'?><Configuration name='Cadence'> <Section name='DocumentTracker'> <Parm name='DetectorConfig' type='string' value='%s' /> <Parm name='FrameHistorySize' type='int' value='50' /> <Parm name='MaxTrackedDocuments' type='int' value='1' /> </Section> <Section name='CheckConfig'> <Parm name='DetectorType' type='string' value='CheckDetector' /> <Parm name='FrontConfig' type='string' value='CheckFrontConfig' /> <Parm name='BackConfig' type='string' value='CheckBackConfig' /> <Parm name='IsFrontExpected' type='bool' value='yes' /> </Section> <Section name='CheckFrontConfig'> <Parm name='DetectorType' type='string' value='CheckFrontDetector' /> <Parm name='SideConfig' type='string' value='CheckSideConfig' /> </Section> <Section name='CheckBackConfig'> <Parm name='DetectorType' type='string' value='CheckBackDetector' /> <Parm name='SideConfig' type='string' value='CheckSideConfig' /> </Section> <Section name='CheckSideConfig'> <Parm name='AspectRatio' type='float' value='%f'/> <Parm name='ContrastThreshold' type='int' value='%d'/> <Parm name='ToleranceRatio' type='float' value='0.02'/> <Parm name='TotalSegmentSupportRatio' type='float' value='2.6'/> <Parm name='MaxTopBottomSegmentSupportRatio' type='float' value='0.65'/> <Parm name='MaxLeftRightSegmentSupportRatio' type='float' value='0.65'/> </Section></Configuration>", checkSide.equals(CheckSide.BACK) ? "CheckBackConfig" : "CheckConfig", Float.valueOf(f), 30);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* loaded from: classes3.dex */
|
||
|
public static class a extends CheckDetectionResult {
|
||
|
private final OrientationGuidance U;
|
||
|
private final b bG;
|
||
|
|
||
|
public a(Rect rect, List<Point> list, com.kofax.mobile.sdk.o.f fVar, CheckSide checkSide, CaptureGuidance captureGuidance, CheckDetectionSettings checkDetectionSettings, IOrientationGuidanceCalculator iOrientationGuidanceCalculator) {
|
||
|
super(rect, list, fVar, checkSide);
|
||
|
this.bG = new b(new k(captureGuidance), checkDetectionSettings, rect, fVar.getWidth(), fVar.getHeight(), getBounds(), true);
|
||
|
this.U = iOrientationGuidanceCalculator.calculate(rect, this.bounds);
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.kmc.ken.engines.data.DetectionResult
|
||
|
public ZoomGuidance getZoomGuidance() {
|
||
|
return this.bG.e();
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.kmc.ken.engines.data.DetectionResult
|
||
|
public TurnGuidance getTurnGuidance() {
|
||
|
return this.bG.getTurnGuidance();
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.kmc.ken.engines.data.DetectionResult
|
||
|
public HorizontalGuidance getHorizontalMovementGuidance() {
|
||
|
return this.bG.getHorizontalMovementGuidance();
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.kmc.ken.engines.data.DetectionResult
|
||
|
public VerticalGuidance getVerticalMovementGuidance() {
|
||
|
return this.bG.getVerticalMovementGuidance();
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.kmc.ken.engines.data.DetectionResult
|
||
|
public OrientationGuidance getOrientationGuidance() {
|
||
|
return this.U;
|
||
|
}
|
||
|
}
|
||
|
}
|