//private void verify(NImage nImage) //{ // var biometricClient = new Neurotec.Biometrics.Client.NBiometricClient(); // var subject = new NSubject(); // var finger = new NFinger { Image = nImage }; // subject.Fingers.Add(finger); // //subject.Fingers[0].Image.Save(subject.Fingers[0].Position + ".png"); // biometricClient.CreateTemplate(subject); // if (subject.Fingers[0].Objects[0].Template == null) // { // throw new Exception("Template is null"); // } // var subject2 = new NSubject(); // var finger2 = new NFinger { Image = nImage }; // subject2.Fingers.Add(finger2); // //subject.Fingers[0].Image.Save(subject.Fingers[0].Position + ".png"); // biometricClient.CreateTemplate(subject2); // if (subject2.Fingers[0].Objects[0].Template == null) // { // throw new Exception("Template2 is null"); // } // var status = biometricClient.Verify(subject, subject2); // if (status != NBiometricStatus.Ok) // { // throw new Exception("Verification failed"); // } //} public Dictionary<string, byte[]> GetTemplatesFromWSQImage(int id, byte[] buffer) { //string dbFingerTable = System.Configuration.ConfigurationManager.AppSettings["dbFingerTable"]; //string dbFingerColumn = System.Configuration.ConfigurationManager.AppSettings["dbFingerColumn"]; //string dbIdColumn = System.Configuration.ConfigurationManager.AppSettings["dbIdColumn"]; ////return; //SqlConnection conn = null; //SqlConnection conn2 = null; //SqlCommand cmd = null; //SqlCommand cmd2 = null; //SqlDataReader reader = null; //NSubject subject; //List<WsqImage> fingersCollection = null; //ArrayList fingersCollection = null; //ArrayList arr = new ArrayList(10); //MemoryStream[] ms = new MemoryStream[11]; //MemoryStream ms; //byte[] buffer = new byte[0]; //int id = 0; //int rowNumber = 0; //StringBuilder sb = new StringBuilder(); Dictionary<string, byte[]> templates = new Dictionary<string, byte[]>(); templates.Add("wsq", buffer); Dictionary<int, string> dict = new Dictionary<int, string>(); dict.Add(0, "li"); dict.Add(1, "lm"); dict.Add(2, "lr"); dict.Add(3, "ll"); dict.Add(4, "ri"); dict.Add(5, "rm"); dict.Add(6, "rr"); dict.Add(7, "rl"); dict.Add(8, "lt"); dict.Add(9, "rt"); BinaryFormatter formatter = new BinaryFormatter(); formatter.Binder = new WsqSerializationBinder.MyBinder<WsqImage>(); //formatter.Binder = new WsqSerializationBinder.GenericBinder<WsqImage>(); //private NBiometricClient _biometricClient; var biometricClient = new NBiometricClient { UseDeviceManager = true, BiometricTypes = NBiometricType.Finger }; _biometricClient.FingersFastExtraction = true; biometricClient.FingersTemplateSize = NTemplateSize.Small; biometricClient.FingersQualityThreshold = 48; biometricClient.Initialize(); //Stopwatch sw = new Stopwatch(); //Stopwatch stwd = new Stopwatch(); //Stopwatch stws = new Stopwatch(); //stw.Start(); //stwd.Start(); //stws.Start(); //try //{ //conn = buildConnectionString(); //var connStr = getConnectionString(); //conn = new SqlConnection(connStr); //conn.Open(); //conn2 = new SqlConnection(connStr); //conn2.Open(); //cmd = new SqlCommand(); //cmd.Connection = conn; //cmd.CommandText = "SELECT " + dbIdColumn + "," + dbFingerColumn + " FROM " + dbFingerTable + " WHERE AppID = 20095420"; //cmd.CommandText = "SELECT " + dbIdColumn + "," + dbFingerColumn + " FROM " + dbFingerTable + " WHERE datalength(" + dbFingerColumn + ") IS NOT NULL"; //cmd.CommandText = String.Format("SELECT AppID, AppWsq FROM (SELECT ROW_NUMBER() OVER(ORDER BY AppID) AS row, AppID, AppWsq FROM Egy_T_FingerPrint WHERE datalength(AppWsq) IS NOT NULL) r WHERE row > {0} and row <= {1}", from, to); //cmd.CommandText = String.Format("SELECT AppID, AppWsq FROM Egy_T_FingerPrint WITH (NOLOCK) WHERE datalength(AppWsq) IS NOT NULL ORDER BY AppID ASC OFFSET {0} ROWS FETCH NEXT {1} ROWS ONLY ", from, count); // cmd.CommandText = String.Format("SELECT AppID, AppWsq FROM Egy_T_FingerPrint WITH (NOLOCK) ORDER BY AppID ASC OFFSET {0} ROWS FETCH NEXT {1} ROWS ONLY ", from, count); //cmd.CommandText = "SELECT AppID, AppWsq FROM Egy_T_FingerPrint WHERE AppID = 20095423"; //reader = cmd.ExecuteReader(); //while (reader.Read()) //{ // rowNumber++; // // Console.WriteLine("{0}", rowNumber + from); // if (!reader.IsDBNull(1)) // { // id = (int)reader[dbIdColumn]; // buffer = (byte[])reader[dbFingerColumn]; ArrayList fingersCollection = null; using (var ms = new MemoryStream(buffer)) { fingersCollection = formatter.Deserialize(ms) as ArrayList; //using(MemoryStream memStream = new MemoryStream(100)) //ms[0] = new MemoryStream(buffer); } //try //{ // //stwd.Restart(); // fingersCollection = formatter.Deserialize(ms) as ArrayList; // //fingersCollection = formatter.Deserialize(ms[0]) as ArrayList; // //Console.WriteLine("Deserialize ArrayList, Time elapsed: {0}, AppId: {1}", stwd.Elapsed, id); //} ////catch (Exception ex) { throw new Exception(ex.ToString()); } ////catch (Exception) { continue; } //finally { ms.Close(); } //finally { ms[0].Close(); } //if (cmd2 != null) //{ // cmd2.Dispose(); // cmd2 = null; //} //scontinue; //if (sb.Length != 0) // sb.Clear(); //stws.Restart(); //String indx = ""; NSubject subject = new NSubject(); NImage nImage = null; NFinger finger = null; //NFRecord template = null; for (int i = 0; i < fingersCollection.Count; i++) { if (fingersCollection[i] != null) { try { //ms[i + 1] = new MemoryStream((fingersCollection[i] as WsqImage).Content); //nImage = NImageFormat.Wsq.LoadImage(ms[i + 1]); //nImage = NImage.FromStream(ms[i + 1], NImageFormat.Wsq); nImage = NImage.FromMemory((fingersCollection[i] as WsqImage).Content, NImageFormat.Wsq); finger = new NFinger { Image = nImage }; //if (subject.Fingers.Count > 0) // subject.Fingers.RemoveAt(0); //var subject = new NSubject(); subject.Fingers.Add(finger); switch (i) { case 0: finger.Position = NFPosition.LeftIndex; break; case 1: finger.Position = NFPosition.LeftMiddle; break; case 2: finger.Position = NFPosition.LeftRing; break; case 3: finger.Position = NFPosition.LeftLittle; break; case 4: finger.Position = NFPosition.RightIndex; break; case 5: finger.Position = NFPosition.RightMiddle; break; case 6: finger.Position = NFPosition.RightRing; break; case 7: finger.Position = NFPosition.RightLittle; break; case 8: finger.Position = NFPosition.LeftThumb; break; case 9: finger.Position = NFPosition.RightThumb; break; } } catch (Exception) { continue; //throw new Exception(string.Format("Error creating image retrieved from database {0}", ex.Message)); } finally { if (finger != null) { finger.Dispose(); finger = null; } if (nImage != null) { nImage.Dispose(); nImage = null; } //if (ms[i + 1] != null) //{ // ms[i + 1].Close(); // ms[i + 1] = null; //} } } } //sw = System.Diagnostics.Stopwatch.StartNew(); try { biometricClient.CreateTemplate(subject); } catch (Exception ex) { while (ex.InnerException != null) ex = ex.InnerException; throw new Exception(ex.Message); } //sw.Stop(); //TimeSpan ts = sw.Elapsed; //string elapsedTime = String.Format("{0:00}.{1:00}", ts.Seconds, ts.Milliseconds / 10); //Console.WriteLine("RunTime " + elapsedTime); bool valid; NFPosition pos = NFPosition.Unknown; //NFRecord record = null; for (int i = 0; i < fingersCollection.Count; i++) { //indx = "@" + dict[i]; //if (sb.Length == 0) //{ // cmd2 = new SqlCommand(); // cmd2.Connection = conn2; // sb.Append("update {0} with (serializable) SET "); //} //else // sb.Append(","); //sb.Append(dict[i] + "=" + indx); //cmd2.Parameters.Add(indx, SqlDbType.VarBinary); //valid = false; if (fingersCollection[i] != null) { switch (i) { case 0: pos = NFPosition.LeftIndex; break; case 1: pos = NFPosition.LeftMiddle; break; case 2: pos = NFPosition.LeftRing; break; case 3: pos = NFPosition.LeftLittle; break; case 4: pos = NFPosition.RightIndex; break; case 5: pos = NFPosition.RightMiddle; break; case 6: pos = NFPosition.RightRing; break; case 7: pos = NFPosition.RightLittle; break; case 8: pos = NFPosition.LeftThumb; break; case 9: pos = NFPosition.RightThumb; break; } //if (sb.Length == 0) //{ // cmd2 = new SqlCommand(); // cmd2.Connection = conn2; // sb.Append("update {0} with (serializable) SET "); //} //else // sb.Append(","); //ms[i + 1] = new MemoryStream(); //formatter.Serialize(ms[i + 1], template); //sb.Append(dict[i] + "=" + indx); //cmd2.Parameters.Add(indx, SqlDbType.VarBinary); valid = false; int k = 0; for (k = 0; k < subject.Fingers.Count; k++) { if (subject.Fingers[k].Position == pos) { if (subject.Fingers[k].Objects.First().Status == NBiometricStatus.Ok) { if (subject.Fingers[k].Objects.First().Quality != 254) { valid = true; //Console.WriteLine(" ----- Size: {0}", subject.Fingers[k].Objects.First().Template.GetSize()); } } break; } } if (!valid) { templates.Add(dict[i], new byte[0]); } else { templates.Add(dict[i], subject.Fingers[k].Objects.First().Template.Save().ToArray()); //record = subject.Fingers[k].Objects.First().Template; //cmd2.Parameters[indx].Value = record.Save().ToArray(); } } else { templates.Add(dict[i], new byte[0]); } } //try //{ // var db = new DAO.Database(); // db.SaveWSQTemplate(id, templates); //} //catch (Exception ex) //{ // throw new Exception(ex.Message); //} if (subject != null) subject.Dispose(); if (biometricClient != null) biometricClient.Dispose(); if (fingersCollection != null) { fingersCollection.Clear(); fingersCollection = null; } return templates; }
private async void btnScan_Click(object sender, EventArgs e) { if (_biometricClient.IrisScanner == null) { MessageBox.Show(@"Seleccione un escaner, por favor"); } else { EnableIrisControls(true); lblStatus.Text = String.Empty; // Create iris _iris = new NIris { Position = rbRight.Checked ? NEPosition.Right : NEPosition.Left }; // Set Manual capturing mode if not automatic selected if (!chbScanAutomatically.Checked) { _iris.CaptureOptions = NBiometricCaptureOptions.Manual; } // Add iris to the subject and irisView _subject = new NSubject(); _subject.Irises.Add(_iris); irisView.Iris = _iris; // Begin capturing NBiometricTask task = _biometricClient.CreateTask(NBiometricOperations.Capture | NBiometricOperations.CreateTemplate, _subject); var performedTask = await _biometricClient.PerformTaskAsync(task); OnIrisCaptureCompleted(performedTask); } }
private void OnEnrollCompleted(NBiometricTask task) { EnableHuellaControls(false); NBiometricStatus status = task.Status; // Check if extraction was canceled if (status == NBiometricStatus.Canceled) { return; } if (status == NBiometricStatus.Ok) { lblQuality.Text = String.Format("Calidad: {0}", _subjectFinger.Objects[0].Quality); if (IsSubjectValid(_subject)) { button1.Enabled = true; } else { MessageBox.Show("La imagen de la huella no es valida"); } } else { MessageBox.Show("No fue posible realizar la lectura de la huella, intente de nuevo", Text, MessageBoxButtons.OK, MessageBoxIcon.Error); _subject = null; _subjectFinger = null; EnableHuellaControls(false); } }
private void StartCapturing() { if (_biometricClient.FaceCaptureDevice == null) { MessageBox.Show(@"Please select camera from the list"); return; } // Set face capture from stream var face = new NFace { CaptureOptions = NBiometricCaptureOptions.Manual }; _subject = new NSubject(); _subject.Faces.Add(face); facesView.Face = face; _biometricClient.FacesDetectAllFeaturePoints = true; // Begin capturing faces _biometricClient.BeginCapture(_subject, OnCapturingCompleted, null); lblStatus.Text = string.Empty; EnableControls(true); ////_task = _biometricClient.CreateTask(NBiometricOperations.Capture | NBiometricOperations.Enroll | NBiometricOperations.Segment | NBiometricOperations.AssessQuality, _subject); ////_biometricClient.PerformTask(_task); ////if (_task.Status == NBiometricStatus.Ok) ////{ //// pictureBoxCroped.Image = _subject.Faces[0].Image.ToBitmap(); //// _croppedPhotoImage = _subject.Faces[0].Image.ToBitmap(); ////} }
public NSubject FingerViewController(NSubject subject, NBiometricClient biometricClient) { using (biometricClient = new NBiometricClient { UseDeviceManager = true }) using (var deviceManager = biometricClient.DeviceManager) { deviceManager.DeviceTypes = NDeviceType.FingerScanner; deviceManager.Initialize(); biometricClient.FingerScanner = (NFScanner)deviceManager.Devices[0]; if (biometricClient.FingerScanner == null) { MessageBox.Show("Please connect your fingerprint scanner"); } else { NFinger subjectFinger = new NFinger(); MessageBox.Show("Place your finger on the scanner"); subjectFinger.CaptureOptions = NBiometricCaptureOptions.Stream; subject = new NSubject(); subject.Fingers.Add(subjectFinger); } } return(subject); }
public EnrollToDatabase(NBiometricStatus status, NSubject subject) { var biometricClient = new NBiometricClient { UseDeviceManager = true }; //database connection through constructor Connection con = new Connection(biometricClient); //add into database NBiometricTask enrollTask = biometricClient.CreateTask(NBiometricOperations.Enroll, subject); biometricClient.PerformTask(enrollTask); status = enrollTask.Status; if (status != NBiometricStatus.Ok) { MessageBox.Show("Enrollment was unsuccessful. status:" + status); if (enrollTask.Error != null) { throw enrollTask.Error; } // return -1; } MessageBox.Show("Enrollment was successful."); }
internal bool SaveActiveUserFingerRecords(NFinger finger, NSubject fingerSubject, FingerDescription fingerDescription) { try { var buffArray = fingerSubject?.GetTemplateBuffer().ToArray(); var fRecord = new FingerImageRecord { FingerIndex = GetFingerIndex(fingerDescription), FingerDescription = fingerDescription, FingerRecord = finger?.Objects[0].Template, FingerSubject = fingerSubject, FingerTemplate = buffArray }; if (finger != null) { var wsq = finger.Image.Save(NImageFormat.Wsq); fRecord.FingerImage = finger.Image.ToBitmap(); fRecord.FingerWsq = wsq?.ToArray(); int fingersCount = 0; var status = CheckDuplicate(fRecord); return(status); } return(false); } catch (Exception ex) { MessageBox.Show(ex.Message); return(false); } }
private void StartCapturing() { //NFingerScanner scanner = scannersListBox.SelectedItem as NFingerScanner; var scanner = (NFingerScanner)_deviceMan.Devices[1]; if (scanner == null) { MessageBox.Show(@"Please select a scanner from the list."); return; } if (scanWorker.IsBusy) { MessageBox.Show(@"Scan already in progress."); return; } scanWorker.RunWorkerAsync(_currentScanner); // Create a finger _subjectFinger = new NFinger(); // Add finger to the subject and fingerView _subject = new NSubject(); _subject.Fingers.Add(_subjectFinger); _subjectFinger.PropertyChanged += OnAttributesPropertyChanged; _nfView.Finger = _subjectFinger; _nfView.ShownImage = ShownImage.Original; // Begin capturing _biometricClient.FingersReturnBinarizedImage = true; var task = _biometricClient.CreateTask(NBiometricOperations.Capture | NBiometricOperations.CreateTemplate, _subject); _biometricClient.BeginPerformTask(task, OnEnrollCompleted, null); }
public override async Task <List <SubjectModel> > GetAllSubjectsAsync() { try { if (!this.IsProcessorReady) { this.ResultLogs.Add(LogSingleton.Instance.LicensesUnavailable); return(null); } List <SubjectModel> subjects = new List <SubjectModel>(); foreach (int subjectID in this.GetAllSubjectIDs()) { NSubject subject = (NSubject)await this.GetSubjectAsync(subjectID); subjects.Add(new SubjectModel() { Path = subject.GetProperty("Path").ToString(), SamplesCount = subject.Irises.Count, SubjectID = subjectID }); } return(subjects); } catch (Exception) { this.ResultLogs.Add(LogSingleton.Instance.SubjectsUnavailable); return(null); } }
private void OnIrisCaptureCompleted(NBiometricTask task) { EnableIrisControls(false); NBiometricStatus status = task.Status; lblStatus.Text = status.ToString(); // Check if extraction was canceled if (status == NBiometricStatus.Canceled) { return; } if (status != NBiometricStatus.Ok) { MessageBox.Show(string.Format("No fue posible extrar el template: {0}.", status), Text, MessageBoxButtons.OK, MessageBoxIcon.Error); lblQuality.Text = string.Empty; _subject = null; _iris = null; EnableIrisControls(false); } else { lblQuality.Text = string.Format("Calidad: {0}", _iris.Objects[0].Quality); } }
public VerificationFromDatabase(NSubject subject) { var biometricClient = new NBiometricClient { UseDeviceManager = true }; //database connection through constructor Connection con = new Connection(biometricClient); NBiometricTask identifyTask = biometricClient.CreateTask(NBiometricOperations.Verify, subject); biometricClient.PerformTask(identifyTask); NBiometricStatus status = identifyTask.Status; if (status != NBiometricStatus.Ok) { MessageBox.Show("Identification was unsuccessful." + status); // Console.ReadLine(); if (identifyTask.Error != null) { throw identifyTask.Error; } //return -1; } foreach (var matchingResult in subject.MatchingResults) { Console.WriteLine("Matched with ID: '{0}' with score {1}", matchingResult.Id, matchingResult.Score); MessageBox.Show("Matched with ID: " + matchingResult.Id + " with score: " + matchingResult.Score); // Console.ReadLine(); } }
private static NSubject CreateSubject(string templateFile, string subjectId) { var subject = new NSubject(); subject.SetTemplateBuffer(new NBuffer(File.ReadAllBytes(templateFile))); subject.Id = subjectId; return(subject); }
private void CapturingOperationInit() { _subject = new NSubject(); var face = new NFace { CaptureOptions = NBiometricCaptureOptions.Stream }; _subject.Faces.Add(face); lockFormFaceView.Face = face; }
private void ButtonCancelClick(object sender, EventArgs e) { //TODO : may be no need to do these if depending on dialog result TemplateLoginForm = null; AddPassword = false; SaveFileName = null; _subject = null; DialogResult = DialogResult.Cancel; }
/* * private void OnCreationCompleted(IAsyncResult r) * { * lock (locker) * { * try * { * NBiometricStatus status = _biometricClient.EndCreateTemplate(r); * if (status != NBiometricStatus.Ok) * { * MessageBox.Show(string.Format("The template was not extracted: {0}.", status)); * } * // EnableVerifyButton(); * } * catch (Exception ex) * { * Utils.ShowException(ex); * } * } * }*/ private string OpenImageTemplate(NFaceView faceView, out NSubject subject) { string savePath = Server.MapPath("~/image/");//指定上传文件在服务器上的保存路径; if (FileUpload1.PostedFile.FileName != null) { if (FileUpload1.HasFile) { //检查服务器上是否存在这个物理路径,如果不存在则创建 if (!System.IO.Directory.Exists(savePath)) { System.IO.Directory.CreateDirectory(savePath); } savePath = savePath + "\\" + FileUpload1.FileName; FileUpload1.SaveAs(savePath); } } subject = null; faceView.Face = null; // msgLabel.Text = string.Empty; string fileLocation = string.Empty; // openFileDialog.FileName = null; // openFileDialog.Title = @"Open Template"; // if (openFileDialog.ShowDialog() == DialogResult.OK) // load template { fileLocation = savePath; // Check if given file is a template try { subject = NSubject.FromFile(savePath); // EnableVerifyButton(); } catch { } // If file is not a template, try to load it as image if (subject == null) { // Create a face object NFace face = new NFace() { FileName = fileLocation }; faceView.Face = face; subject = new NSubject(); subject.Faces.Add(face); // Extract a template from the subject nle.CreateTemplate(subject); } } //subject.Dispose(); return(fileLocation); }
public async Task ParseCleansubject() { var subjectPath = Path.Combine(MockDataDirectory, "NSubject_Clean.json"); var subjectRaw = File.ReadAllText(subjectPath); var subject = await NSubject.ParseAsync(subjectRaw); Assert.IsNotNull(subject); Assert.IsNotNull(subject.Path); Assert.IsNotNull(subject.SubjectType); }
public override async Task <bool> LoadFromScannerAsync(object device, char eye) { try { if (!this.IsProcessorReady) { this.ResultLogs.Add(LogSingleton.Instance.LicensesUnavailable); return(false); } if (!File.Exists("Irises.ndf")) { this.ResultLogs.Add(LogSingleton.Instance.IrisesNDF); return(false); } this.subject = new NSubject(); if (this.iris is null) { this.ResultLogs.Add(LogSingleton.Instance.PreviewUnavailable); return(false); } this.biometricClient.IrisScanner = (NIrisScanner)device; NEPosition?nEPosition = this.CharToNEPosition(eye); if (!nEPosition.HasValue) { return(false); } this.iris.Position = nEPosition.Value; this.subject.Irises.Add(this.iris); this.biometricClient.IrisesTemplateSize = NTemplateSize.Large; NBiometricTask task = this.biometricClient.CreateTask(NBiometricOperations.Capture | NBiometricOperations.CreateTemplate, this.subject); NBiometricTask performedTask = await this.biometricClient.PerformTaskAsync(task); if (performedTask.Status != NBiometricStatus.Ok) { this.CreateErrorLogWithStatus(LogSingleton.Instance.CaptureExtractionFailed, performedTask.Status); return(false); } this.ResultLogs.Add(LogSingleton.Instance.CaptureExtractionResult); return(true); } catch (Exception) { this.ResultLogs.Add(LogSingleton.Instance.CaptureExtractionFailed); return(false); } }
private static NSubject CreateSubject(string fileName, bool isMultipleSubjects) { var subject = new NSubject { IsMultipleSubjects = isMultipleSubjects }; var face = new NFace { FileName = fileName }; subject.Faces.Add(face); return(subject); }
public bool SaveBioRecord(NFinger finger, NSubject fingerSubject, FingerDescription fingerDescription, bool isTrue) { try { return(_CaptureFingerNotifyer(finger, fingerSubject, fingerDescription, isTrue)); } catch (Exception ex) { MessageBox.Show(ex.ToString()); return(false); } }
private void VerificationOperationInit() { VerificationOperationButtonconfig(); lblInfo.Text = Resources.Capturing_user___; _subject = new NSubject(); var face = new NFace { CaptureOptions = NBiometricCaptureOptions.Stream }; _subject.Faces.Add(face); nlockLoginFaceView.Face = _subject.Faces[0]; _currentop = Ops.Ongoing; _biometricClient.BeginCapture(_subject, OnCapturingCompleted, null); }
public static async Task <INCondition> ParseAsync(JObject conditionObject) { try { var subject = NSubject.Parse(conditionObject["Subject"].ToString()); var op = NOperator.Parse(conditionObject["Operator"].ToString()); var reference = JObject.Parse(conditionObject["Reference"].ToString()); return(new NCondition(subject, op, reference)); } catch (JsonReaderException ex) { throw new NConditionParseException(ex); } }
public IdentificationFromImage(string subjectID, string templateFile) { string components = "Biometrics.FingerMatching"; //obtain license ControllerUtils.ObtainLicense(components); using (var biometricClient = new NBiometricClient()) // Read template using (NSubject subject = CreateSubject(templateFile, subjectID)) { //Identification done from IdentificationFromDatabase constructor IdentificationFromDatabase identify = new IdentificationFromDatabase(subject); } }
public Verification(string subjectID) { { string fileName = "E:\\Fingerprint sample\\Latest Sample\\Second Template Generated"; string components = "Biometrics.FingerMatching"; ControllerUtils.ObtainLicense(components); using (var biometricClient = new NBiometricClient()) // Read template using (NSubject subject = CreateSubject(fileName, subjectID)) { //Identification done from IdentificationFromDatabase constructor VerificationFromDatabase verify = new VerificationFromDatabase(subject); } } }
private async void BtnStartClickAsync(object sender, EventArgs e) { if (capturedFaces.Count == 7) { MessageBox.Show("All Faces captured."); return; } if (_biometricClient.FaceCaptureDevice == null) { MessageBox.Show(@"Please select camera from the list"); return; } // Set face capture from stream _face = new NFace { CaptureOptions = NBiometricCaptureOptions.Stream }; _subject = new NSubject(); _subject.Faces.Add(_face); fvPreview.Face = _face; icaoWarningView.Face = _face; _biometricClient.FacesCheckIcaoCompliance = true; var task = _biometricClient.CreateTask(NBiometricOperations.Capture | NBiometricOperations.Segment | NBiometricOperations.CreateTemplate, _subject); /*var task = _biometricClient.CreateTask(NBiometricOperations.Capture | NBiometricOperations.Segment, _subject);*/ lblStatus.Text = string.Empty; EnableControls(true); try { var performedTask = await _biometricClient.PerformTaskAsync(task); OnCapturingCompleted(performedTask); } catch (Exception ex) { Utils.ShowException(ex); lblStatus.Text = string.Empty; EnableControls(false); var a = 8; } }
public EnrollmentFromImage(string subjectID, string imageFile) { string components = "Biometrics.FingerExtraction"; //call Obtain License to obtain license ControllerUtils.ObtainLicense(components); try { using (var biometricClient = new NBiometricClient { UseDeviceManager = true }) // using (var deviceManager = biometricClient.DeviceManager) using (var subject = new NSubject()) using (var finger = new NFinger()) { finger.FileName = imageFile; subject.Fingers.Add(finger); subject.Id = subjectID; //ID number in the database //Set finger template size (recommended, for enroll to database, is large) biometricClient.FingersTemplateSize = NTemplateSize.Large; NBiometricStatus status = NBiometricStatus.InternalError; //creates template using the image status = biometricClient.CreateTemplate(subject); if (status == NBiometricStatus.Ok) { ControllerUtils.SaveTemplate(subject); //enroll into database using EnrollToDatabase Constructor EnrollToDatabase enrollToDatabase = new EnrollToDatabase(status, subject); } else { Console.WriteLine("Extraction failed! Status: {0}", status); } } }catch (Exception ex) { MessageBox.Show(ex.ToString()); } // return 0; }
private void LockFormFormClosed(object sender, FormClosedEventArgs e) { if (_subject != null) { _subject.Dispose(); _subject = null; } if (_biometricClient != null) { _biometricClient.Dispose(); _biometricClient = null; } Settings.Default.LockFormWidth = Width; Settings.Default.LockFormHeight = Height; Settings.Default.Save(); Settings.Default.Reload(); }
public void FingerViewController(NFingerView fingerView) { using (var biometricClient = new NBiometricClient { UseDeviceManager = true }) using (var deviceManager = biometricClient.DeviceManager) { deviceManager.DeviceTypes = NDeviceType.FingerScanner; deviceManager.Initialize(); biometricClient.FingerScanner = (NFScanner)deviceManager.Devices[0]; while (biometricClient.FingerScanner != null) { NFinger subjectFinger = new NFinger(); MessageBox.Show("Place your finger on the scanner"); subjectFinger.CaptureOptions = NBiometricCaptureOptions.Stream; var subject = new NSubject(); subject.Fingers.Add(subjectFinger); } } }
private async void btnIdentifyFromScanner_Click(object sender, EventArgs e) { using (var biometricClient = new NBiometricClient { UseDeviceManager = true }) using (var deviceManager = biometricClient.DeviceManager) { deviceManager.DeviceTypes = NDeviceType.FingerScanner; deviceManager.Initialize(); biometricClient.FingerScanner = (NFScanner)deviceManager.Devices[0]; if (biometricClient.FingerScanner == null) { MessageBox.Show(@"Please connect a fingerprint scanner"); } else { subjectFinger = new NFinger(); MessageBox.Show("Place your finger on the scanner"); subjectFinger.CaptureOptions = NBiometricCaptureOptions.Stream; subject = new NSubject(); subject.Fingers.Add(subjectFinger); subjectFinger.PropertyChanged += OnAttributesPropertyChanged; FingerViewIdentification.Finger = subjectFinger; FingerViewIdentification.ShownImage = ShownImage.Original; FingerViewIdentification.Show(); biometricClient.FingersReturnBinarizedImage = true; NBiometricTask task = biometricClient.CreateTask(NBiometricOperations.Capture /* | NBiometricOperations.CreateTemplate*/, subject); //NBiometricStatus status = biometricClient.Capture(subject); //status = biometricClient.CreateTemplate(subject); var performTask = await biometricClient.PerformTaskAsync(task); // EnrollmentFromScanner enrollmentFromScanner = new EnrollmentFromScanner(subjectID, subject); IdentificationFromScanner identificationByScanner = new IdentificationFromScanner(subjectID, subject); } } }
protected override async Task <object> GetSubjectAsync(int subjectID) { try { NSubject subj = new NSubject { Id = subjectID.ToString() }; NBiometricTask task = this.biometricClient.CreateTask(NBiometricOperations.Get, subj); NBiometricTask performedTask = await this.biometricClient.PerformTaskAsync(task); if (performedTask.Status != NBiometricStatus.Ok) { return(null); } return(performedTask.Subjects.Count > 0 ? performedTask.Subjects[0] : null); } catch (Exception) { return(null); } }
private async void btnStart_Click(object sender, EventArgs e) { #region Iniciar captura de facial if (_biometricClient.FaceCaptureDevice == null) { MessageBox.Show(@"Seleccione una camara de la lista"); return; } // Set face capture from stream var face = new NFace { CaptureOptions = NBiometricCaptureOptions.Stream }; if (!chbCaptureAutomatically.Checked) { face.CaptureOptions |= NBiometricCaptureOptions.Manual; } _subjectFace = new NSubject(); _subjectFace.Faces.Add(face); facesView.Face = face; // Begin capturing faces EnableFaceControls(true); lblStatus.Text = string.Empty; //lblQuality.Text = string.Empty; try { var status = await _biometricClient.CaptureAsync(_subjectFace); await OnCapturingFaceCompletedAsync(status); } catch (Exception ex) { Neurotec.Samples.Utils.ShowException(ex); lblStatus.Text = string.Empty; //lblQuality.Text = string.Empty; EnableFaceControls(false); } #endregion }
//save template into directory public static void SaveTemplate(NSubject subject) { try { BdifStandard standard = BdifStandard.Unspecified; //ISO or ANSI template stadard can be set before extraction Console.WriteLine("{0} template extracted.", standard == BdifStandard.Iso ? "ISO" : standard == BdifStandard.Ansi ? "ANSI" : "Proprietary"); Console.WriteLine("Template extracted"); if (standard == BdifStandard.Iso) { //create BDifStandard.ISO template File.WriteAllBytes(Config.TemplateNameISO(), subject.GetTemplateBuffer(CbeffBiometricOrganizations.IsoIecJtc1SC37Biometrics, CbeffBdbFormatIdentifiers.IsoIecJtc1SC37BiometricsFingerMinutiaeRecordFormat, FMRecord.VersionIsoCurrent).ToArray()); Console.WriteLine("ISO template saved successfully"); } else if (standard == BdifStandard.Ansi) { //create BDifStandard.ANSI template File.WriteAllBytes(Config.TemplateNameANSI(), subject.GetTemplateBuffer(CbeffBiometricOrganizations.IncitsTCM1Biometrics, CbeffBdbFormatIdentifiers.IncitsTCM1BiometricsFingerMinutiaeU, FMRecord.VersionAnsiCurrent).ToArray()); Console.WriteLine("ANSI template saved successfully"); } else { //create general template File.WriteAllBytes(Config.TemplateNameGeneral(), subject.GetTemplateBuffer().ToArray()); Console.WriteLine("template saved successfully"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public SerializationProcess(string ProbeTemplate) { subject = NSubject.FromFile(ProbeTemplate); //subject = null; //int i = 0; }
//public void run(int from, int to, int count, int threadId) //public void run(int from, int to) public void run(int from, int count) { string dbFingerTable = System.Configuration.ConfigurationManager.AppSettings["dbFingerTable"]; string dbFingerColumn = System.Configuration.ConfigurationManager.AppSettings["dbFingerColumn"]; string dbIdColumn = System.Configuration.ConfigurationManager.AppSettings["dbIdColumn"]; //return; //SqlConnection conn = null; //SqlConnection conn2 = null; //SqlCommand cmd = null; //SqlCommand cmd2 = null; //SqlDataReader reader = null; NSubject subject; //List<WsqImage> fingersCollection = null; ArrayList fingersCollection = null; //ArrayList arr = new ArrayList(10); //MemoryStream[] ms = new MemoryStream[11]; MemoryStream ms = null; //MemoryStream ms; byte[] buffer = new byte[0]; int id = 0; int rowNumber = 0; StringBuilder sb = new StringBuilder(); Dictionary<int, string> dict = new Dictionary<int, string>(); dict.Add(0, "li"); dict.Add(1, "lm"); dict.Add(2, "lr"); dict.Add(3, "ll"); dict.Add(4, "ri"); dict.Add(5, "rm"); dict.Add(6, "rr"); dict.Add(7, "rl"); dict.Add(8, "lt"); dict.Add(9, "rt"); BinaryFormatter formatter = new BinaryFormatter(); formatter.Binder = new WsqSerializationBinder.MyBinder<WsqImage>(); //formatter.Binder = new WsqSerializationBinder.GenericBinder<WsqImage>(); _biometricClient = new NBiometricClient { UseDeviceManager = true, BiometricTypes = NBiometricType.Finger }; _biometricClient.FingersFastExtraction = false; _biometricClient.FingersTemplateSize = NTemplateSize.Small; _biometricClient.FingersQualityThreshold = 48; _biometricClient.Initialize(); Stopwatch sw = new Stopwatch(); //Stopwatch stwd = new Stopwatch(); //Stopwatch stws = new Stopwatch(); //stw.Start(); //stwd.Start(); //stws.Start(); try { //conn = buildConnectionString(); var connectionString = getConnectionString(); connectionString += String.Format(";Max Pool Size={0}", _maxPoolSize); using (SqlConnection conn = new SqlConnection(connectionString)) using (SqlConnection conn2 = new SqlConnection(connectionString)) { //conn = new SqlConnection(connStr); conn.Open(); //conn2 = new SqlConnection(connStr); conn2.Open(); SqlCommand cmd = new SqlCommand(); cmd.CommandTimeout = 0; cmd.Connection = conn; SqlCommand cmd2 = null; //SqlCommand cmd2 = new SqlCommand(); //cmd2.CommandTimeout = 0; //cmd2.Connection = conn2; //cmd.CommandText = "SELECT " + dbIdColumn + "," + dbFingerColumn + " FROM " + dbFingerTable + " WHERE AppID = 20095420"; //cmd.CommandText = "SELECT " + dbIdColumn + "," + dbFingerColumn + " FROM " + dbFingerTable + " WHERE datalength(" + dbFingerColumn + ") IS NOT NULL"; //cmd.CommandText = String.Format("SELECT AppID, AppWsq FROM (SELECT ROW_NUMBER() OVER(ORDER BY AppID) AS row, AppID, AppWsq FROM Egy_T_FingerPrint WHERE datalength(AppWsq) IS NOT NULL) r WHERE row > {0} and row <= {1}", from, to); //cmd.CommandText = String.Format("SELECT AppID, AppWsq FROM Egy_T_FingerPrint WITH (NOLOCK) WHERE datalength(AppWsq) IS NOT NULL ORDER BY AppID ASC OFFSET {0} ROWS FETCH NEXT {1} ROWS ONLY ", from, count); cmd.CommandText = String.Format("SELECT AppID, AppWsq FROM Egy_T_FingerPrint WITH (NOLOCK) ORDER BY AppID ASC OFFSET {0} ROWS FETCH NEXT {1} ROWS ONLY ", from, count); //cmd.CommandText = "SELECT AppID, AppWsq FROM Egy_T_FingerPrint WHERE AppID = 20095423"; //sw.Start(); //reader = cmd.ExecuteReader(); using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { rowNumber++; if (rowNumber % 10 == 0) { //Console.WriteLine("{0} ----- Time elapsed: {1}", rowNumber + from, sw.Elapsed); Console.WriteLine("{0}", rowNumber + from); //Console.WriteLine(" ----- Time elapsed: {0}", sw.Elapsed); //sw.Restart(); } //continue; if (!reader.IsDBNull(1)) { id = (int)reader[dbIdColumn]; buffer = (byte[])reader[dbFingerColumn]; ms = new MemoryStream(buffer); //ms[0] = new MemoryStream(buffer); try { //stwd.Restart(); fingersCollection = formatter.Deserialize(ms) as ArrayList; //fingersCollection = formatter.Deserialize(ms[0]) as ArrayList; //Console.WriteLine("Deserialize ArrayList, Time elapsed: {0}, AppId: {1}", stwd.Elapsed, id); } //catch (Exception ex) { throw new Exception(ex.ToString()); } catch (Exception) { continue; } finally { ms.Close(); } //finally { ms[0].Close(); } //if (cmd2 != null) //{ // cmd2.Dispose(); // cmd2 = null; //} //continue; if (sb.Length != 0) sb.Clear(); //stws.Restart(); String indx = ""; subject = new NSubject(); NImage nImage = null; //NFRecord template = null; //continue; //if (id == 20000017) //{ // sw.Start(); // for (int j = 0; j < 100; j++) { // for (int i = 0; i < fingersCollection.Count; i++) // { // if (fingersCollection[i] != null) // { // nImage = NImage.FromMemory((fingersCollection[i] as WsqImage).Content, NImageFormat.Wsq); // } // } // } // Console.WriteLine(" ----- Time elapsed: {0}", sw.Elapsed); // return; //} for (int i = 0; i < fingersCollection.Count; i++) { if (fingersCollection[i] != null) { try { //ms[i + 1] = new MemoryStream((fingersCollection[i] as WsqImage).Content); //nImage = NImageFormat.Wsq.LoadImage(ms[i + 1]); //nImage = NImage.FromStream(ms[i + 1], NImageFormat.Wsq); //break; //sw.Restart(); nImage = NImage.FromMemory((fingersCollection[i] as WsqImage).Content, NImageFormat.Wsq); //Console.WriteLine(" ----- Time elapsed: {0}", sw.Elapsed); //sw.Reset(); //break; var finger = new NFinger { Image = nImage }; //if (subject.Fingers.Count > 0) // subject.Fingers.RemoveAt(0); //break; //var subject = new NSubject(); //sw.Restart(); subject.Fingers.Add(finger); //Console.WriteLine(" ----- Time elapsed: {0}", sw.Elapsed); //break; switch (i) { case 0: finger.Position = NFPosition.LeftIndex; break; case 1: finger.Position = NFPosition.LeftMiddle; break; case 2: finger.Position = NFPosition.LeftRing; break; case 3: finger.Position = NFPosition.LeftLittle; break; case 4: finger.Position = NFPosition.RightIndex; break; case 5: finger.Position = NFPosition.RightMiddle; break; case 6: finger.Position = NFPosition.RightRing; break; case 7: finger.Position = NFPosition.RightLittle; break; case 8: finger.Position = NFPosition.LeftThumb; break; case 9: finger.Position = NFPosition.RightThumb; break; } } catch (Exception ex) { if (ex.Message.Equals("Operation is not activated")) throw new Exception(ex.Message); continue; //throw new Exception(string.Format("Error creating image retrieved from database {0}", ex.Message)); } finally { if (nImage != null) { nImage.Dispose(); nImage = null; } //if (ms[i + 1] != null) //{ // ms[i + 1].Close(); // ms[i + 1] = null; //} } } } //continue; //sw = System.Diagnostics.Stopwatch.StartNew(); _biometricClient.CreateTemplate(subject); //sw.Stop(); //TimeSpan ts = sw.Elapsed; //string elapsedTime = String.Format("{0:00}.{1:00}", ts.Seconds, ts.Milliseconds / 10); //Console.WriteLine("RunTime " + elapsedTime); bool valid; NFPosition pos = NFPosition.Unknown; NFRecord record = null; for (int i = 0; i < fingersCollection.Count; i++) { indx = "@" + dict[i]; if (sb.Length == 0) { //cmd2.Cancel(); cmd2 = new SqlCommand(); cmd2.CommandTimeout = 0; cmd2.Connection = conn2; sb.Append("update {0} with (serializable) SET "); } else sb.Append(","); sb.Append(dict[i] + "=" + indx); cmd2.Parameters.Add(indx, SqlDbType.VarBinary); //valid = false; if (fingersCollection[i] != null) { switch (i) { case 0: pos = NFPosition.LeftIndex; break; case 1: pos = NFPosition.LeftMiddle; break; case 2: pos = NFPosition.LeftRing; break; case 3: pos = NFPosition.LeftLittle; break; case 4: pos = NFPosition.RightIndex; break; case 5: pos = NFPosition.RightMiddle; break; case 6: pos = NFPosition.RightRing; break; case 7: pos = NFPosition.RightLittle; break; case 8: pos = NFPosition.LeftThumb; break; case 9: pos = NFPosition.RightThumb; break; } //if (sb.Length == 0) //{ // cmd2 = new SqlCommand(); // cmd2.Connection = conn2; // sb.Append("update {0} with (serializable) SET "); //} //else // sb.Append(","); //ms[i + 1] = new MemoryStream(); //formatter.Serialize(ms[i + 1], template); //sb.Append(dict[i] + "=" + indx); //cmd2.Parameters.Add(indx, SqlDbType.VarBinary); valid = false; int k = 0; for (k = 0; k < subject.Fingers.Count; k++) { if (subject.Fingers[k].Position == pos) { if (subject.Fingers[k].Objects.First().Status == NBiometricStatus.Ok) { if (subject.Fingers[k].Objects.First().Quality != 254) { valid = true; //Console.WriteLine(" ----- Size: {0}", subject.Fingers[k].Objects.First().Template.GetSize()); } } break; } } if (!valid) cmd2.Parameters[indx].Value = new byte[0]; else { record = subject.Fingers[k].Objects.First().Template; cmd2.Parameters[indx].Value = record.Save().ToArray(); } } else { cmd2.Parameters[indx].Value = new byte[0]; } } if (sb.Length != 0) { sb.Append(" where {1} = @id"); cmd2.CommandText = String.Format(sb.ToString(), dbFingerTable, dbIdColumn); cmd2.Parameters.Add("@id", SqlDbType.Int); cmd2.Parameters["@id"].Value = id; //conn2 = new SqlConnection(getConnectionString()); //conn2.Open(); //cmd2.Connection = MyConnection.Connection2; cmd2.ExecuteNonQuery(); //cmd2.CommandText = String.Format(@"update {0} with (serializable) SET li = @li // where {1} = @id", dbFingerTable, dbIdColumn); } /* cmd2.Parameters.Add("@id", SqlDbType.Int); cmd2.Parameters["@id"].Value = id; cmd2.Parameters.Add("@li", SqlDbType.VarBinary); cmd2.Parameters["@li"].Value = arr[0]; //cmd.Parameters.Add("@lm", SqlDbType.VarBinary); //cmd.Parameters["@lm"].Value = arr[1]; cmd2.ExecuteNonQuery(); */ //TimeSpan ts = stws.Elapsed; //string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00000000}", // ts.Hours, ts.Minutes, ts.Seconds, // ts.Milliseconds); //Console.WriteLine("Serialize WsqImage, Time elapsed: {0}", elapsedTime); //Console.WriteLine("Serialize WsqImage, Time elapsed: {0}", stws.Elapsed); //Console.WriteLine("TaskId: {0}, Serialize WsqImage, Time elapsed: {1}", threadId, stws.ElapsedMilliseconds); //Console.WriteLine("AppId: {0}", id); //arr.Clear(); //if (record != null) //{ // record.Dispose(); // record = null; //} subject = null; if (fingersCollection != null) { fingersCollection.Clear(); fingersCollection = null; } //for (int i = 0; i < 11; i++) //{ // if (ms[i] != null) // { // ms[i].Close(); // ms[i] = null; // } //} //if (id % 10 == 0) //{ // //Console.WriteLine(id); // Console.WriteLine("Number of Records Retrieved: {0}, Time elapsed: {1}", numRecordsRetrieved, stw.Elapsed); // //Console.WriteLine("Thread Id: {3], Number of Records Retrieved: {0}, Time elapsed: {1}", numRecordsRetrieved, stw.Elapsed, threadId); // //stw.Restart(); //} } } } } //Console.WriteLine("From: {0}, To: {1}, Number of Records Retrieved: {2}", from, to, numRecordsRetrieved); //Console.WriteLine("Thread Id: {0}, Number of Records Retrieved: {1}, Time elapsed: {2}", threadId, numRecordsRetrieved, stw.Elapsed); } catch (Exception ex) { throw new Exception(ex.Message); } //finally //{ // try // { // if (reader != null) // reader.Close(); // if (conn != null && conn.State == ConnectionState.Open) // { // conn.Close(); // conn = null; // } // if (conn2 != null && conn2.State == ConnectionState.Open) // { // conn2.Close(); // conn2 = null; // } // } // catch (Exception ex) // { // throw new Exception(ex.Message); // } //} }
public void enrollProbeTemplate(ArrayList fingerList, byte[] probeTemplate) { _probeSubject = NSubject.FromMemory(probeTemplate); if (_probeSubject == null) throw new Exception("Probe template is null"); //finger.Position = NFPosition.UnknownTwoFingers; //_subject.MissingFingers.Clear(); //foreach (Object o in chlbMissing.CheckedItems) //{ // _subject.MissingFingers.Add((NFPosition)o); //} //_biometricClient.FingersDeterminePatternClass = true; //_biometricClient.FingersCalculateNfiq = true; //NBiometricTask task = _biometricClient.CreateTask(NBiometricOperations.Segment | NBiometricOperations.CreateTemplate | NBiometricOperations.AssessQuality, _probeSubject); //NBiometricTask task = _biometricClient.CreateTask(NBiometricOperations.Segment | NBiometricOperations.CreateTemplate, _probeSubject); //_biometricClient.PerformTask(task); //if (task.Error == null) { //var sb = new StringBuilder(); int segmentsCount = _probeSubject.Fingers.Count; if (segmentsCount > 0 && _probeSubject.Fingers[0].Status == NBiometricStatus.Ok) { //sb.Append(string.Format("Templates extracted: \n")); if (_probeSubject.Fingers[0].Objects[0].Template != null) { if (_probeSubject.Fingers[0].Position == NFPosition.Unknown) _probeSubject.Fingers[0].Position = getFingerPositionByTag(fingerList[0].ToString()); //sb.Append(string.Format("{0}: {1}. Size: {2}\n", fingerList[0].ToString(), // string.Format("Quality: {0}", _probeSubject.Fingers[1].Objects[0].Quality), _probeSubject.Fingers[1].Objects[0].Template.GetSize())); } //finger = _probeSubject.Fingers[1]; } if (segmentsCount > 1 && _probeSubject.Fingers[1].Status == NBiometricStatus.Ok) { if (_probeSubject.Fingers[1].Objects[0].Template != null) { if (_probeSubject.Fingers[1].Position == NFPosition.Unknown) _probeSubject.Fingers[1].Position = getFingerPositionByTag(fingerList[1].ToString()); //sb.Append(string.Format("{0}: {1}. Size: {2}\n", fingerList[1].ToString(), // string.Format("Quality: {0}", _probeSubject.Fingers[2].Objects[0].Quality), _probeSubject.Fingers[2].Objects[0].Template.GetSize())); } } if (segmentsCount > 2 && _probeSubject.Fingers[2].Status == NBiometricStatus.Ok) { if (_probeSubject.Fingers[2].Objects[0].Template != null) { if (_probeSubject.Fingers[2].Position == NFPosition.Unknown) _probeSubject.Fingers[2].Position = getFingerPositionByTag(fingerList[2].ToString()); //sb.Append(string.Format("{0}: {1}. Size: {2}\n", fingerList[2].ToString(), // string.Format("Quality: {0}", _probeSubject.Fingers[3].Objects[0].Quality), _probeSubject.Fingers[3].Objects[0].Template.GetSize())); } } if (segmentsCount > 3 && _probeSubject.Fingers[3].Status == NBiometricStatus.Ok) { if (_probeSubject.Fingers[3].Objects[0].Template != null) { if (_probeSubject.Fingers[3].Position == NFPosition.Unknown) _probeSubject.Fingers[3].Position = getFingerPositionByTag(fingerList[3].ToString()); //sb.Append(string.Format("{0}: {1}. Size: {2}\n", fingerList[3].ToString(), // string.Format("Quality: {0}", _probeSubject.Fingers[4].Objects[0].Quality), _probeSubject.Fingers[4].Objects[0].Template.GetSize())); } } } //else { // if (task.Error != null) // throw new Exception("Probe template error: " + task.Error.Message); // else // throw new Exception("Probe template unknown error"); //} // _probeSubject = NSubject.FromMemory(probeTemplate[0]); //if (_probeSubject == null) // throw new Exception("Probe template is null"); }