robertvazan / sourceafis-java

Fingerprint recognition engine for Java that takes a pair of human fingerprint images and returns their similarity score. Supports efficient 1:N search.
https://sourceafis.machinezoo.com/java
Apache License 2.0
245 stars 100 forks source link

Am GEtting my image from a url how possible to match?? #53

Closed babaoye closed 2 years ago

babaoye commented 2 years ago

hello please am getting my image from a url how possible to match??

url="myapi/biometrics/" + biometerics + ".JPEG"; Bitmap bitmap = Glide .with(FtrScanDemoUsbHostActivity.this) .asBitmap() .load(url) .diskCacheStrategy(DiskCacheStrategy.NONE) .skipMemoryCache(true) .centerCrop() .submit() .get(); ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream); byte[] byteArray = stream.toByteArray(); FingerprintTemplate probe = new FingerprintTemplate().dpi(500).create(byteArray);

File extStorageDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); mDir = new File(extStorageDirectory,"Mypath/Biometrics/"+mybiometrics+".JPEG"); Bitmap myBitmap = BitmapFactory.decodeFile(mDir.getAbsolutePath()); ByteArrayOutputStream stream2 = new ByteArrayOutputStream(); myBitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream2); byte[] byteArray2 = stream2.toByteArray();

                FingerprintTemplate candidate = new FingerprintTemplate().dpi(500).create(byteArray2);
                 score = new FingerprintMatcher(probe)
                        .match(candidate);

but when i want to compile my apk i get a warning of this

com.android.tools.r8.internal.YI0: One or more instruction is preventing default interface method from being desugared: java.lang.Double it.unimi.dsi.fastutil.objects.Reference2DoubleMap.getOrDefault(java.lang.Object, java.lang.Double)

can anyone help with a better way of doing this using the New Api Method Call Points that is

FingerprintTemplate probe = new FingerprintTemplate( new FingerprintImage( Files.readAllBytes(Paths.get("probe.png")), new FingerprintImageOptions() .dpi(500)));

                FingerprintTemplate candidate = new FingerprintTemplate(
                        new FingerprintImage(
                                Files.readAllBytes(Paths.get("candidate.png")),
                                new FingerprintImageOptions()
                                        .dpi(500)));
robertvazan commented 2 years ago

Android API level?

babaoye commented 2 years ago

android { compileSdk 32

lintOptions {
    disable 'RestrictedApi'
}

defaultConfig {
    applicationId "com.em.ef"
    minSdk 21
    targetSdk 32
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    javaCompileOptions {
        annotationProcessorOptions {
            arguments += [
                    "room.schemaLocation":"$projectDir/schemas".toString(),
                    "room.incremental":"true",
                    "room.expandProjection":"true"]
        }
    }
}
robertvazan commented 2 years ago

Here's your problem: minSdk 21

From the tutorial:

On Android, SourceAFIS requires Android API level 24+ (tested with SourceAFIS 3.14.2).