4

I have been working on a small application to get fingerprints after 3 scanned. I used the ZKFingerSDK and when trying to get the register finger prints it brings the image back as black. I am using the ZK9500 device

if (RegisterCount >= REGISTER_FINGER_COUNT && !bIdentify)
{

    RegisterCount = 0;
    ret = GenerateRegisteredFingerPrint();   // <--- GENERATE FINGERPRINT TEMPLATE


    if (zkfp.ZKFP_ERR_OK == ret)
    {

        ret = AddTemplateToMemory();        //  <--- LOAD TEMPLATE TO MEMORY
        if (zkfp.ZKFP_ERR_OK == ret)         // <--- ENROLL SUCCESSFULL
        {
            string fingerPrintTemplate = string.Empty;
            zkfp.Blob2Base64String(newRegTmp, cbCapTmp, ref fingerPrintTemplate);
            newRegTmp =  zkfp.Base64String2Blob(fingerPrintTemplate);

            Bitmap bmp2;
            MemoryStream ms2 = new MemoryStream();

                BitmapFormat.GetBitmap(newRegTmp, mfpWidth, mfpHeight, ref ms2);
                bmp2 = new Bitmap(ms2);
                this.pictureBox1.Image = bmp2;


            Console.WriteLine("finger print" + fingerPrintTemplate);
            textRes.AppendText("merged " + fingerPrintTemplate + "\n");
        }
    }
}
Rikus
  • 188
  • 3
  • 14

1 Answers1

2

I assume ret = AddTemplateToMemory(); loads the template into newRegTmp.

zkfp.Blob2Base64String(newRegTmp, cbCapTmp, ref fingerPrintTemplate); from this line i understand that you have the rawdata of the fingerprint at newRegTmp and you are extracting the size of cbCapTmp into fingerPrintTemplate.

In that case, you should not use newRegTmp in next line newRegTmp =zkfp.Base64String2Blob(fingerPrintTemplate); , which overwrites the actual data with the Base64 string. You can use Base64 string for displaying image on the web page with img tag. But to convert the raw data into image, you need to pass the actual data to GetBitMap.

If the above suggestion doesnt work, please share the implementation of AddTemplateToMemory.

Ravanan
  • 536
  • 2
  • 13
  • This is my implementation: `private int GenerateRegisteredFingerPrint() { return fpInstance.GenerateRegTemplate(RegTmps[0], RegTmps[1], RegTmps[2], newRegTmp, ref cbRegTmp); } private int AddTemplateToMemory() { return fpInstance.AddRegTemplate(iFid, newRegTmp); }` – Rikus Aug 19 '19 at 06:17
  • I have added the out put on the question – Rikus Aug 19 '19 at 07:17
  • You can get the image from every scanning and you can get the merged template out of three scanned data. But, image can not be merged. Only template can be merged. – Ravanan Aug 21 '19 at 07:18
  • can I then save that merged template as a image? – Rikus Aug 21 '19 at 13:55
  • While you scan the fingerprint , you will get template and a image. So you will have image for every scanning. If you want to maintain the image, then either you can one of them or all of them. Merged template is not a image. The size of the template would be between 2k-3k, where as image would in 100k+ (png). – Ravanan Aug 21 '19 at 17:09
  • Thank you Ramshri. How can I load the image back to he devices memory if I have saved the byte array – Rikus Aug 22 '19 at 07:40
  • Welcome. Just wondering, why do you need to load the image back into scanner memory. You have to use the template alone for the comparison. – Ravanan Aug 22 '19 at 15:54
  • I want to compare the one that was saved previously and stored in my db to the new one scanned to verify the students new finger print with the one from the db – Rikus Aug 23 '19 at 06:24
  • You need to use the merged template with newly scanned template for the comparison. You can use the images only for display purpose. – Ravanan Aug 24 '19 at 15:58
  • Okay so I can save the merged template to my systems db and then let the user scanned a new one and compare it? if so how will i do it? – Rikus Aug 27 '19 at 11:11