private async void MainFormLoadAsync(object sender, EventArgs e) { _biometricClient = new NBiometricClient { BiometricTypes = NBiometricType.Face, UseDeviceManager = true, FacesCheckIcaoCompliance = true, FacesQualityThreshold = byte.Parse("0"), }; await _biometricClient.InitializeAsync(); if (!DesignMode) { try { nViewZoomSlider1.View = fvPreview; lblStatus.Text = string.Empty; _deviceManager = _biometricClient.DeviceManager; saveImageDialog.Filter = NImages.GetSaveFileFilterString(); UpdateCameraList(); } catch (Exception ex) { Utils.ShowException(ex); } } }
private void SaveImageButtonClick(object sender, EventArgs e) { if (_nfView.Finger.Image == null) { return; } saveFileDialog.Filter = NImages.GetSaveFileFilterString(); saveFileDialog.Title = @"Save Image File"; if (saveFileDialog.ShowDialog() != DialogResult.OK) { return; } var fileName = saveFileDialog.FileName; try { _subjectFinger.Image.Save(fileName); } catch (Exception ex) { MessageBox.Show(string.Format("Error saving to file \"{0}\": {1}", fileName, ex), Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void EnrollFromCameraLoad(object sender, EventArgs e) { try { if (!DesignMode) { try { lblStatus.Text = string.Empty; _deviceManager = _biometricClient.DeviceManager; saveImageDialog.Filter = NImages.GetSaveFileFilterString(); UpdateCameraList(); StartCapturing(); } catch (Exception ex) { AppUtils.ShowException(ex); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); AppErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); if (ex.InnerException != null) { AppErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); } } }
public EnrollView(string subjectId) { InitializeComponent(); openFileDialog.Filter = NImages.GetOpenFileFilterString(true, true); string component = "Biometrics.FingerExtraction,Biometrics.FingerMatching,Devices.FingerScanners,Images.WSQ,Biometrics.FingerSegmentation,Biometrics.FingerQualityAssessmentBase"; ControllerUtils.ObtainLicense(component); }
private void EnrollFromScannerLoad(object sender, EventArgs e) { Invoke(new Action(() => { try { _deviceManager = _biometricClient.DeviceManager; UpdateScannerList(); saveFileDialog.Filter = NImages.GetSaveFileFilterString(); _nfView = new NFingerView { Dock = DockStyle.Fill, AutoScroll = true }; panel.Controls.Add(_nfView); StartCapturing(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } })); }
protected void Button1_Click(object sender, EventArgs e) { openFaceImageDlg = new OpenFileDialog(); openFaceImageDlg.Filter = NImages.GetOpenFileFilterString(true, true); if (openFaceImageDlg.ShowDialog() == DialogResult.OK) { if (_image != null) { _image.Dispose(); } _image = null; try { // Read image _image = NImage.FromFile(openFaceImageDlg.FileName); // DetectFace(_image); } catch (Exception ex) { // Utils.ShowException(ex); } } }
private void OnImage(NGrayscaleImage image) { clearView(); if (nfView1.Image == null) { nfView1.Image = image.ToBitmap(); } NGrayscaleImage resultImage = (NGrayscaleImage)image.Clone(); try { NfeExtractionStatus extractionStatus; template = Data.NFExtractor.Extract(resultImage, NFPosition.Unknown, NFImpressionType.LiveScanPlain, out extractionStatus); if (extractionStatus != NfeExtractionStatus.TemplateCreated) { string text = string.Format("Extraction failed: {0}", extractionStatus.ToString()); ShowErrorMessage(text); LogLine(text, true); //LogLine("Waiting for image...", true); pictureBox2.Image = Properties.Resources.redcross; // MessageBox.Show(text, Text, MessageBoxButtons.OK, MessageBoxIcon.Error); // sw.Stop(); //stopProgressBar(); //UseWaitCursor = false; return; } } catch (Exception e) { string text = string.Format("Extraction error: {0}", e.Message); ShowErrorMessage(text); LogLine(text, true); pictureBox2.Image = Properties.Resources.redcross; return; } finally { //WaitingForImageToScan(); //stopProgressBar(); !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! } Bitmap bitmap; using (NImage ri = NImages.GetGrayscaleColorWrapper(resultImage, resultImageMinColor, resultImageMaxColor)) { bitmap = ri.ToBitmap(); } this.template = (NFRecord)template.Clone(); nfView2.ResultImage = bitmap; if (nfView2.Template != null) { nfView2.Template.Dispose(); } nfView2.Template = this.template; if (template == null) { ResourceManager rm = new ResourceManager("PSCBioVerification.Form1", this.GetType().Assembly); string text = rm.GetString("msgFingerprintImageIsOfLowQuality"); // "Fingerprint image is of low quality" ShowErrorMessage(text); LogLine(text, true); pictureBox2.Image = Properties.Resources.redcross; //MessageBox.Show(text, Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } LogLine("Template extracted{0}. G: {1}. Size: {2}", true, Data.NFExtractor.UseQuality ? string.Format(". Quality: {0:P0}", Helpers.QualityToPercent(template.Quality) / 100.0) : null, template.G, Data.SizeToString(template.Save().Length)); ShowStatusMessage(String.Format("Template extracted{0}. G: {1}. Size: {2}", true, Data.NFExtractor.UseQuality ? string.Format(". Quality: {0:P0}", Helpers.QualityToPercent(template.Quality) / 100.0) : null, template.G, Data.SizeToString(template.Save().Length))); switch (mode) { case ProgramMode.Enroll: doEnroll(); nfView2.Zoom = 1F; break; case ProgramMode.Verify: doVerify(); nfView2.Zoom = 0.5F; break; } WaitingForImageToScan(); }
public EnrollFromCamera() { //_template = template; InitializeComponent(); saveImageDialog.Filter = NImages.GetSaveFileFilterString(); }