c# - Finger Print recognition system -


i m using vs2008 , sourceafis 1.1 m unable access of methods may me getting started they(sourceafis) gave following sample program.cs want develope application firstly enrolls users , identify them if enrolled user or not.

namespace sample {      public class program     {         // inherit fingerprint in order add filename field         [serializable]         class myfingerprint : fingerprint         {             public string filename;         }          // inherit person in order add name field         [serializable]         class myperson : person         {             public string name;         }          // initialize path images         static readonly string imagepath = path.combine(path.combine("..", ".."), "images");          // shared afisengine instance (cannot shared between different threads though)         static afisengine afis;          // take fingerprint image file , create person object image         static myperson enroll(string filename, string name)         {             console.writeline("enrolling {0}...", name);              // initialize empty fingerprint object , set properties             myfingerprint fp = new myfingerprint();             fp.filename = filename;             // load image file, fp.bitmapimage makes copy of image, can dispose afterwards             console.writeline(" loading image {0}...", filename);             using (image fromfile = bitmap.fromfile(filename))                 using (bitmap bitmap = new bitmap(fromfile))                     fp.bitmapimage = bitmap;             // above update of fp.bitmapimage initialized raw image in fp.image             // check raw image dimensions, y axis first, x axis second             console.writeline(" image size = {0} x {1} (width x height)", fp.image.getlength(1), fp.image.getlength(0));              // execute extraction in order initialize fp.template             console.writeline(" extracting template...");             afis.extract(fp);             // check template size             console.writeline(" template size = {0} bytes", fp.template.length);              // initialize empty person object , set properties             myperson person = new myperson();             person.name = name;             // add fingerprint person             person.add(fp);              return person;         }          static void main(string[] args)         {              // initialize sourceafis             afis = new afisengine();              // enroll people             list<myperson> database = new list<myperson>();             database.add(enroll(path.combine(imagepath, "candidate1.tif"), "fred flintstone"));             database.add(enroll(path.combine(imagepath, "candidate2.tif"), "wilma flintstone"));             database.add(enroll(path.combine(imagepath, "candidate3.tif"), "barney rubble"));              // save database disk , load back, try out serialization             binaryformatter formatter = new binaryformatter();             console.writeline("saving database...");             using (stream stream = file.open("database.dat", filemode.create))                 formatter.serialize(stream, database);             console.writeline("reloading database...");             using (filestream stream = file.openread("database.dat"))                 database = (list<myperson>)formatter.deserialize(stream);              // enroll visitor unknown identity             myperson probe = enroll(path.combine(imagepath, "probe.tif"), "visitor #12345");              // probe using threshold = 10             afis.threshold = 10;             console.writeline("identifying {0} in database of {1} persons...", probe.name, database.count);             myperson match = afis.identify(probe, database);                  // null result means there no candidate similarity score above threshold             if (match == null)             {                 console.writeline("no matching person found.");                 return;             }             // print out non-null result             console.writeline("probe {0} matches registered person {1}", probe.name, match.name);              // compute similarity score             float score = afis.verify(probe, match);             console.writeline("similarity score between {0} , {1} = {2:f3}", probe.name, match.name, score);         }     } 

        // initialize sourceafis         if (afis == null) afis = new afisengine();          // enroll fitst identity         fingerprint f = new fingerprint();         f.asbitmap = (bitmap)pictureboxfinger.image;          person probe = new person();         probe.fingerprints.add(f);         afis.extract(probe);          // enroll second identity                     fingerprint f2 = new fingerprint();         f2.asbitmap = (bitmap)pictureboxverify.image;         person match = new person();         match.fingerprints.add(f2);         afis.extract(match);          // compute similarity score         float score = afis.verify(probe, match); 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -