Page 1 of 1

Invalid sample resolution for enroll task in VeriFinger SDk

PostPosted: May 26, 2017 11:01
by cohnjarmack
Hi,

I'm trying to create a fingerprint attendance application on Android, and using "Neurotec_Biometric_9_0_SDK_Trial" to try and write a sample App. I have fetched image from the fingerprint scanner, with resolution 384 x 290 pixels (w x h). This is the image scanned by U.are.U 4500 digital persona scanner, and is rated at 512 ppi. The image when loaded comes across as 72 ppi (Since the image is larger than the finger). I have created the JPEG byte array from the pixel array using the following code

Code: Select all
        Bitmap bitmap = Bitmap.createBitmap(pixelData, IMAGE_WIDTH, IMAGE_HEIGHT, Bitmap.Config.ARGB_8888);
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        bitmap.compress(Bitmap.CompressFormat.JPEG, QUALITY, byteArrayOutputStream);
        return byteArrayOutputStream.toByteArray();


To validate that this byteArray is correct, I have saved it into a file and opened the file in a photo editor, and this works flawlessly, and is the 384 x 290 with 72 ppi, meaning that the jpeg is correct.

Code: Select all
        File photo=new File(Environment.getExternalStorageDirectory(), "photo.jpg");
        FileOutputStream fos=new FileOutputStream(photo.getPath());
        fos.write(byteArray);
        fos.close();


Now, when I try to enroll this fingerprint, I am able to read it into an NImage which shows the width and height correctly, meaning parsing has worked, but enrolling gives the error "invalid sample resolution". I have tried setting HorzResolution and VertResolution to both 72 and 512 to ensure that I'm not missing anything but it has not worked. I even tried the default option of 500.

Code: Select all
      NBiometricClient biometricClient = new NBiometricClient();
      subject = new NSubject();
      finger = new NFinger();
      NImage image = NImageUtils.fromJPEG(byteArray);
      image.setHorzResolution(512);
      image.setVertResolution(512);

      Log.d("MainActivity","Image width and height = " + image.getWidth() + " " + image.getHeight());
      Log.d("MainActivity", "Image h and v res = " + image.getHorzResolution() + " " + image.getVertResolution());

      finger.setImage(image);
      subject.getFingers().add(finger);

      biometricClient.setFingersTemplateSize(NTemplateSize.LARGE);
      NBiometricTask task = biometricClient.createTask(EnumSet.of(NBiometricOperation.CREATE_TEMPLATE), subject);
      biometricClient.performTask(task);




I am unable to figure out what else I'm missing. Please help.

Re: Invalid sample resolution for enroll task in VeriFinger

PostPosted: May 26, 2017 12:15
by MartynasV
Hello cohnjarmack,

Call following code before setting resolution:
Code: Select all
image.ResolutionIsAspectRatio = false;

Re: Invalid sample resolution for enroll task in VeriFinger

PostPosted: May 26, 2017 12:59
by cohnjarmack
That worked! Thanks.

Re: Invalid sample resolution for enroll task in VeriFinger

PostPosted: May 26, 2017 20:16
by cohnjarmack
Thank you, that resolved the issue.