44 lines
2.1 KiB
Java
44 lines
2.1 KiB
Java
package com.kofax.kmc.ken.engines;
|
|
|
|
import android.graphics.Bitmap;
|
|
import com.kofax.android.abc.machine_vision.GlareDetector;
|
|
import com.kofax.kmc.ken.engines.data.QuickAnalysisSettings;
|
|
import java.util.Locale;
|
|
|
|
/* loaded from: classes3.dex */
|
|
class j implements IGlareDetector {
|
|
private final GlareDetector bJ = new GlareDetector();
|
|
|
|
static {
|
|
System.loadLibrary("a1ac4");
|
|
System.loadLibrary("ee77d4");
|
|
System.loadLibrary("d8b3e6");
|
|
System.loadLibrary("b2681f");
|
|
}
|
|
|
|
@Override // com.kofax.kmc.ken.engines.IGlareDetector
|
|
public boolean detectGlare(QuickAnalysisSettings quickAnalysisSettings, Bitmap bitmap) {
|
|
boolean z;
|
|
if (!quickAnalysisSettings.getGlareDetection()) {
|
|
return false;
|
|
}
|
|
synchronized (this.bJ) {
|
|
this.bJ.loadConfigurationString(a(quickAnalysisSettings.getGlareDetectionIntensityFraction(), quickAnalysisSettings.getGlareDetectionIntensityThreshold(), quickAnalysisSettings.getGlareDetectionMinimumGlareAreaFraction(), quickAnalysisSettings.getGlareDetectionNumberOfTiles()), "DocumentDetection.GlareDetection");
|
|
this.bJ.grabImageFrame(bitmap);
|
|
double detectGlare = this.bJ.detectGlare();
|
|
this.bJ.releaseFrame();
|
|
z = detectGlare >= quickAnalysisSettings.getGlareDetectedThreshold();
|
|
}
|
|
return z;
|
|
}
|
|
|
|
protected void finalize() throws Throwable {
|
|
this.bJ.dispose();
|
|
super.finalize();
|
|
}
|
|
|
|
private String a(double d, int i, double d2, int i2) {
|
|
return String.format(Locale.US, "<?xml version='1.0' encoding='iso-8859-1'?><Configuration name='Cadence'> <Section name='DocumentDetection'> <Section name=\"GlareDetection\"> <Parm name=\"IntensityFraction\" type=\"float\" value=\"%f\"/> <Parm name=\"IntensityThreshold\" type=\"int\" value=\"%d\"/> <Parm name=\"MinimumGlareAreaFraction\" type=\"float\" value=\"%f\"/> <Parm name=\"NumberOfTiles\" type=\"int\" value=\"%d\"/> </Section> </Section></Configuration>", Double.valueOf(d), Integer.valueOf(i), Double.valueOf(d2), Integer.valueOf(i2));
|
|
}
|
|
}
|