adafruit / Adafruit-Fingerprint-Sensor-Library

Arduino library for interfacing to the fingerprint sensor in the Adafruit shop
http://www.adafruit.com/products/751
Other
415 stars 340 forks source link

Template comparison #9

Open nonthanut opened 8 years ago

nonthanut commented 8 years ago

I notice I could extract a fingerprint's template from the library. I wonder whether there is anyway to upload the template to my server where I can compute the matching score.

(As the FP sensor could store a limited number of fingerprints, I plan to keep a database for all the templates on the server instead. The issue now is how to match a template at the server.)

kalyanisoholkar commented 8 years ago

I have the same problem. I have to save the template in a mysql database and then again retrieve it to match. I extracted the template now i need to send this template for matching,but i dont know where to send this template for matching..Please help..

information-security commented 7 years ago

Any hints on this? a SDK is a must have for this product. If anyone has any idea what is the algorithm I can do the coding part.

alphashuro commented 7 years ago

has anyone figured this out yet? i'm also trying to do this

qwerty13 commented 7 years ago

It's my question too

drichardcarl commented 7 years ago

Does anyone know how to match fingerprint templates when you have them ? I can extract the templates generated after the enrollment. In my case, after enrollment, I don't store the template to the internal memory of the device but I store the template to my computer.

Obaid-ur-Rehman commented 7 years ago

Please post a sample code to extract template. I see there is no function to extract template in the library. Thanks

drichardcarl commented 7 years ago

@Obaid-ur-Rehman the sample code is here. I hope this will help you and the others. Note that the format of the template is specified by the manufacturer, it is neither in ISO nor ANSI template format. https://pastecode.xyz/view/2c8914d0

Try-Parser commented 7 years ago

I am now able to get then finger print template and store in a db using base64 encoding and load it to the sensor for match. it should be 556 + 12 = 568 bytes with the headers

Obaid-ur-Rehman commented 7 years ago

@drichardcarl Thank you. Unfortunately the link does not works, could be broken. Can you please share an alternative link?

Obaid-ur-Rehman commented 7 years ago

@Try-Parser Can you please share the source code. Thank you

ladyada commented 7 years ago

@drichardcarl the code has been added to the show_fingerprint_templates example! @Try-Parser please check out the example and send over a PR if you have some other code that may work for htis and we'll integrate it!

MeghanShark commented 7 years ago

I get the error "no matching function for call to 'Adafruit_Fingerprint::Adafruit_Fingerprint(SoftwareSerial*)'

vilipwong commented 6 years ago

Is there a way to upload template into the sensor for matching ?

qwerty13 commented 6 years ago

Yes, there is upChar in datasheets, but there isn't upChar function in the library...

ricarduscat commented 6 years ago

Yes, I would like to have this function implemented, I tried to fix the library but doesn't work... Anyone can help me? I just opened a new issue

one-player commented 6 years ago

How to synchronize prints between two modules. Tell me please. For example, if I use two modules and one will fail. How do I make a module dump in order to unload it into a new module?

ricarduscat commented 6 years ago

I'm doing this function, to put external templates into the flash memory of the sensor. This is the function:

uint8_t Adafruit_Fingerprint::downloadModel(uint16_t id, uint8_t packet_1[], uint8_t packet_2[], uint8_t packet_3[], uint8_t packet_4[], uint8_t slot) { uint8_t packet[] = {FINGERPRINT_DOWNLOAD, slot}; writePacket(theAddress, FINGERPRINT_COMMANDPACKET, sizeof(packet)+2, packet); uint8_t len = getReply(recvPacket); uint8_t x; if ((len != 1) && (recvPacket[0] != FINGERPRINT_ACKPACKET)) return -1; if (recvPacket[1] == 0x00) { writePacket(theAddress, 0x02, 66, packet_1); writePacket(theAddress, 0x02, 66, packet_2); writePacket(theAddress, 0x02, 66, packet_3); writePacket(theAddress, 0x08, 66, packet_4); return recvPacket[1]; } else { return -1; } }

This works. You have to call this function in the arduino code and it saves the fingerprint to buffer1, later, you have to call the SaveModel function to save the template with the ID. But there is a problem. There is no control ACK packets for the datapackets you send, so you can't control if the entire template is reaching the sensor. The decumentations says nothing about it... so... really?? No ACK paquets for every datapacket?? The down Char functon it's totally useless without this control... You will never be able to put an entire template to buffer 1

marianodato commented 6 years ago

Anyone found a solution to upload a template to the sensor?

chhass commented 6 years ago

@drichardcarl did you solve this problem, matching fingerprint templates data? I mean comparing data directly, without loading data in sensor...

m-jayson commented 6 years ago

Hi guys, Is there a way where I can get the ff:

  1. get the equivalent hash or byte value of my FP and send it over to the backend via Serial for saving to DB. 2.get the earlier FP template sent via Serial then use it for the Sensor to match against the current FP which i just put into the sensor?

My goal is to save the FP to the DB and later on retrieve via Arduino UNO and FP sensor to compare against different FP until matched.

Thanks

chhass commented 6 years ago

@mgonzaga1990,

you can do that, but, perhaps serial data rate, can take a lot of time if you need to search several FP's.

With 115200bps, you will be able to send 28 FP's/second, that's too slow!

We need a algorith to match FP template/char file.

m-jayson commented 6 years ago

@chhass I'm working on a project where the FP from the sensor should be saved in the database. I have a frontend (VB.NET) and backend (Java) and database connected to the backend.

the FP sensor is connected to the frontend via serial. While VB.net is connected to Java via RestAPI.

so initially, the user would sign in and register his FP (that's why i need the FP template and save it in the DB). then later on once the user has login using his FP. The FP stored in the DB will be used to compare against the FP template that he use to login.

joseluissegura commented 6 years ago

I send to the fp-module the following package 0xEF01 0xFFFFFFFF 0x08 0x01 sum and it returns 0xEF01 0xFFFFFFFF 0x07 0x0003 0x00 0x000A (ack package saying "ready to transfer the following data packet") I wait 5 secs and starts reading the serial port but it only receives 0xEF01 0xFFFFFFFF 0x02 0x0042 (and 54 more bytes) it never sends more than that, no matter how much time I wait for the rest of the bytes.

I have 2 fp scanners and they both return the same

ps: I have the sysparam of the package size set to 64 I already tried 32, 128 and 256

kamsri81 commented 6 years ago

Hi, I have my fingerprint sensor connected to my linux laptop using /dev/ttyUSB0. I am trying to upload a fingerprint template image from the sensor to the PC. This works fine using the UpChar() command.Then i try to dump the same data back to the fingerprint sensor using DownChar() and match it with the live finger using Match command.However the match command returns error( 0x01h: error when receiving data package).My packet length is set to 256.The data sent by the sensor exactly matches with the data sent to the sensor..I would really appreciate if someone could help me out...

Here is a snippet of my code for Downloading code from the laptop to the sensor. unsigned char DownChar(unsigned char * pDataBuffer,unsigned int bufferid,unsigned int buflen) {

    unsigned char PLen=0x04;
unsigned char CheckSum=0;
    unsigned int written = 0;
    unsigned int packetLen=256;

memset(packet, 0, sizeof(packet));
memset(RecPacket, 0, sizeof(RecPacket));
    memset(SendDataPacket1, 0, sizeof(SendDataPacket1));
    memset(SendDataPacket2, 0, sizeof(SendDataPacket2));
CheckSum=CalCheckSum(PID,PLen,FINGERPRINT_DOWNCHAR,bufferid);

    packet[0] = (FINGERPRINT_STARTCODE >> 8) & 0xFF;    
packet[1] = FINGERPRINT_STARTCODE & 0xFF;
packet[2] = (theAddress >> 24) & 0xFF;
packet[3] = (theAddress >> 16) & 0xFF;
packet[4] = (theAddress >> 8) & 0xFF;   
packet[5] = theAddress & 0xFF;
packet[6] = PID & 0xFF;
packet[7] = (PLen >> 8) & 0xFF; 
packet[8] = PLen & 0xFF;
packet[9] = FINGERPRINT_DOWNCHAR & 0xFF;
    packet[10] = bufferid;
packet[11]= (CheckSum >> 8) & 0xFF;
packet[12]= CheckSum & 0xFF;

    while (buflen > packetLen){
        PrepareDataPacket1(theAddress, FINGERPRINT_DATAPACKET, packetLen+2, pDataBuffer+written);
        written += packetLen;
        buflen -= packetLen;
 }
    PrepareDataPacket2(theAddress, FINGERPRINT_ENDDATAPACKET, buflen+2, pDataBuffer+written);

write(FPS,packet,sizeof(packet));
delay(1000);
read(FPS,RecPacket,sizeof(RecPacket));
delay(1000);

    if (RecPacket[9] == 0x0){
    write(FPS,SendDataPacket1,sizeof(SendDataPacket1));
    write(FPS,SendDataPacket2,sizeof(SendDataPacket2));

    }

}

dheeptuck commented 6 years ago

I am also looking for a way to authenticate the captured fingerprint outside the FP sensor.

kamsri81 commented 6 years ago

Hi dheeptuck, Did you have any luck with the DownChar() command? Whenever i write the data (Same data which i read using UpChar() command) back to the sensor it gives error( 0x01h: error when receiving data package).I have contacted the Rhydolabz support team but they have still not got back on this.

beerni commented 6 years ago

Any news on this?

qwerty13 commented 6 years ago

Any Success for make use of DownChar?

janioanselmo commented 5 years ago

Hi, @dheeptuck and everyone else interested in validating the "template" externally! I have been developing a solution for access control for a long time. However, a large majority of readers (financially viable) can not do external validation (servers - LINUX/Windows/MAC). What I have evaluated and accomplished is the work of a genius, named: Robert Važan - https://github.com/robertvazan/sourceafis-java Have a look, incredible!

hanifizzudinrahman commented 5 years ago

Alhamdulillah, i have finished our Project for Research and Development for Fingerprint Module (with ZFM20 or DY50/FPM10A) This is include file C for Arduino and surely the libraries Enroll + Match + Upload Template + Show Template + Delete & Empty + Show Image Template + SFG Demo

So, i uploaded in github, you can visit it in https://github.com/hanifizzudinrahman/Module-Fingerprint-DY50-FPM10A

hanifizzudinrahman commented 5 years ago

Fingerprint Module Fingerprint Module Schematic Schematic

Arpit-exe commented 5 years ago

I have modified and combined adafruit's enroll code with show fingerprint template to generate a workable code which scans a finger gets the image and converts it to a template and upload it to the serial monitor. Successfully

bekelemulugeta commented 5 years ago

Arpit-exe#could you give me your code please?

hanifizzudinrahman commented 5 years ago

Alhamdulillah, i have finished our Project for Research and Development for Fingerprint Module (with ZFM20 or DY50/FPM10A) This is include file C for Arduino and surely the libraries Enroll + Match + Upload Template + Show Template + Delete & Empty + Show Image Template + SFG Demo

So, i uploaded in github, you can visit it in https://github.com/hanifizzudinrahman/Module-Fingerprint-DY50-FPM10A

this code can help you. dont forget to change the library, because it's corresponding with the code

bekelemulugeta commented 5 years ago

thank you very much

Abrie1995 commented 5 years ago

@bekelemulugeta did you manage to match a template to the live finger on the fingerprint sensor? or did anyone got this to work?

chadianscot commented 5 years ago

I've just started playing with extracting templates from a JM-101B which seems to be a ZFM-20 essentially. My problem is that when I send the UPCHAR command to extract the template, I get 846 bytes back (ACK packet and headers included). Based on hanifizzudinrahman's project, I should be expecting 554 bytes. Has anyone else seen this difference?

hanifizzudinrahman commented 5 years ago

I've just started playing with extracting templates from a JM-101B which seems to be a ZFM-20 essentially. My problem is that when I send the UPCHAR command to extract the template, I get 846 bytes back (ACK packet and headers included). Based on hanifizzudinrahman's project, I should be expecting 554 bytes. Has anyone else seen this difference?

UPCHAR is upload template to upper computer (0x08) When i use ZFM20, i get 4 lines that in 1 line includes 139 bytes data

==> So, in 1 line i get (9 + 128 + 2) bytes = 139 bytes and in 4 lines, i get (139 x 4) bytes = 556 bytes

Honestly, i limit the UPCHAR command only in 4 lines. You can change it in the arduino code "ZFM20_ShowTemplate.ino" Why i limit it? because the data template fingerprint after line 4 is ZERO (00 00 ..... 00). So, this is the data default of template fingerprint when there is no more data from module fingerprint.

And from chadianscot's problem, make sure that the 846 bytes data, there is no zero data Even though that 846 bytes data is right data, you can still upload your data template fingerprint from upper computer to module (0x09) with little modification in the library and header ".uploadModelPercobaan(packet2,....,packet5)"

i'm so glad to help someone problem. Ask me again when you have any problem... :D

danilpan commented 5 years ago

Guys, how can i extract template from this sensor?

hanifizzudinrahman commented 5 years ago

To extract template fingerprint from module fingerprint to mikrokontroler

  1. from mikrokontroler, you have to send command "download 0x08" to module fingerprint. you can look in datasheet of your module fingerprint

  2. after that, module fingerprint will reply your command

  3. next, module fingerprint will send you a package of template fingerprint -- Module Fingerprint DY50 (6 package) 2 Packet Command -- Module Fingerprint ZFM20 (4 package)

  4. After that, You must filter it to pull out only the Template Fingerprint. you can visit my github project

danilpan commented 5 years ago

Thank you for your answer hanifizzudinrahman. Can I take Template without comparing with other fingerprints? How much time it will take? Could you help with it?

Anisank25 commented 5 years ago

I am now able to get then finger print template and store in a db using base64 encoding and load it to the sensor for match. it should be 556 + 12 = 568 bytes with the headers

Can you explain or attach code that you used to store it?

kejuqeju commented 5 years ago

@hanifizuddin i am experiencing same thing as you did. are you sure that the template data in the 5th packet and following packets always 0 ? have you try with different fingerprints? second question: when i send command upchar (sends template data to CharBuff), do i have to send all the packet data or just the first 4 packets ?

hanifizzudinrahman commented 5 years ago

Thank you for your answer hanifizzudinrahman. Can I take Template without comparing with other fingerprints? How much time it will take? Could you help with it?

yes you can take the template without comparing it. but, about the time, i forget. i have calculate it, but i forget. i think, the time is less than 1 second

hanifizzudinrahman commented 5 years ago

@hanifizuddin i am experiencing same thing as you did. are you sure that the template data in the 5th packet and following packets always 0 ? have you try with different fingerprints? second question: when i send command upchar (sends template data to CharBuff), do i have to send all the packet data or just the first 4 packets ?

yes, i have try it with different fingerprints. It appears zero because the module only save a packet of template fingerprint according on datasheet. you can read using "read parameter" in second question, refers on my first answer. the charBuff on module is limited, according on datasheet. So, only first 4 packets that will sent

kejuqeju commented 5 years ago

i just checked and tried some fingerprints. it is true that for some fingerprints, they only need 4 data packets. the rest 8 packets are zeros. but if i tried larger fingers, like thumbs, i saw that it needs 6 data packets.

danwillm commented 5 years ago

Was there anything happening on this? I to want to get something to compare templates working as well. Thanks!

yvesniyo commented 5 years ago

I've just started playing with extracting templates from a JM-101B which seems to be a ZFM-20 essentially. My problem is that when I send the UPCHAR command to extract the template, I get 846 bytes back (ACK packet and headers included). Based on hanifizzudinrahman's project, I should be expecting 554 bytes. Has anyone else seen this difference?

UPCHAR is upload template to upper computer (0x08) When i use ZFM20, i get 4 lines that in 1 line includes 139 bytes data

  • 9 bytes data --> 2 bytes Header ( EF 01) --> 4 bytes Address (FF FF FF FF) --> 1 byte Identifier (02) --> 2 bytes Length (00 82)

    "00 82" means in biner "130" the length of data template + check sum

  • 128 bytes data --> This is the important data, because this is the data template of our fingerprint

    "03 03 ..... 00", this is the part of my template fingerprint

  • 2 bytes data --> This is the data of Check sum (12 DF)

    The Sum of "Identifier" , "Length" and "Data Template"

==> So, in 1 line i get (9 + 128 + 2) bytes = 139 bytes and in 4 lines, i get (139 x 4) bytes = 556 bytes

Honestly, i limit the UPCHAR command only in 4 lines. You can change it in the arduino code "ZFM20_ShowTemplate.ino" Why i limit it? because the data template fingerprint after line 4 is ZERO (00 00 ..... 00). So, this is the data default of template fingerprint when there is no more data from module fingerprint.

And from chadianscot's problem, make sure that the 846 bytes data, there is no zero data Even though that 846 bytes data is right data, you can still upload your data template fingerprint from upper computer to module (0x09) with little modification in the library and header ".uploadModelPercobaan(packet2,....,packet5)"

i'm so glad to help someone problem. Ask me again when you have any problem... :D

I have tried so many times by using this function "uploadModelPercobaan()" with my saved packet2 to packet5 and but none has ever matched, please is it possible to get it compared in fingerprint device or not going to happen so that I can start to look for how I can extract image and then compare them with another program

rehamouv303 commented 4 years ago

To extract template fingerprint from module fingerprint to mikrokontroler

  1. from mikrokontroler, you have to send command "download 0x08" to module fingerprint. you can look in datasheet of your module fingerprint
  2. after that, module fingerprint will reply your command
  3. next, module fingerprint will send you a package of template fingerprint -- Module Fingerprint DY50 (6 package) 2 Packet Command -- Module Fingerprint ZFM20 (4 package)
  4. After that, You must filter it to pull out only the Template Fingerprint. you can visit my github project

How can I extract template from fingerprint module R307 !! Using uno... can you give me code for it

teezzan commented 4 years ago

@hanifizzudinrahman , Thank you very much. It works very well. Jazakumullahu khyran.