/// <summary> /// Creates an instance of <see cref="XmlIdentity" />. /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="faceRecognition">The face recognition.</param> /// <param name="storage">The storage implementation.</param> public XmlIdentity(IConfiguration configuration, IFaceRecognition faceRecognition, IStorage storage) { _configuration = configuration; _faceRecognition = faceRecognition; _group = _configuration["Identity:Face Collection"]; _storage = storage; _verificationThreshold = float.Parse(_configuration["Identity:Verification Threshold"]); }
public FaceCamera(int camWidth, int camHeight, IFaceRecognition faceRecognition) { faceFrame = Resources.FaceFrame; this.faceRecognition = faceRecognition; videoCapture = new VideoCapture(); camSize = new Size(camWidth, camHeight); faceRecognition.FacePhotoSaved += (object sender, EventArgs e) => FacePhotoSaved?.Invoke(sender, e); faceRecognition.LoadRecognizer(); }
public User(int uid, IFaceRecognition faceRecognizer) { this.uid = uid; this.id = "tmp_jhhgfd"; //should be initialized with temp id if (faceRecognizer == null) throw new Exception("Could not initialize face recognition! No recognizer supplied"); faceRecog = faceRecognizer.getNewInstance(id); faceRecog.detected += new EventHandler(faceRecog_detected); faceRecog.recognized += new EventHandler(faceRecog_recognized); lastUpdate = DateTime.Now; lastRecogUpdate = DateTime.Now.Subtract(new TimeSpan(0, 0, 10)); //set 10 sec behind current time Debug.WriteLine("New user create | tempId => " + id); }
/// <summary> /// Creates an instance of <see cref="HitListController" />. /// </summary> /// <param name="configuration">The configuration settings.</param> /// <param name="faceRecognition">The face recognition service.</param> public HitListController(IConfiguration configuration, IFaceRecognition faceRecognition, IStorage storage) { _configuration = configuration; _faceRecognition = faceRecognition; _storage = storage; }
/// <summary> /// Initializes a new instance of the <see cref="RecognitionService"/> class. /// </summary> /// <param name="faceRecognition">The face recognition.</param> /// <param name="faceSimilarity">The face similarity.</param> public RecognitionService(IFaceRecognition faceRecognition, IFaceSimilarity faceSimilarity) { _faceRecognition = faceRecognition; _faceSimilarity = faceSimilarity; }
public EmployeeService(IEmployeeRepository employeeRepository, IFaceRecognition faceRecognition) { _employeeRepository = employeeRepository; _faceRecognition = faceRecognition; }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services .Configure <CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }) .AddSingleton(options => this.Configuration) .AddScoped <IStorage>(factory => { string implementation = this.Configuration["Face Recognition:Implementation"]; if (implementation == "Azure") { return(new AzureStorage(this.Configuration)); } else if (implementation == "Local") { return(new LocalStorage(this.Configuration)); } else { throw new NotSupportedException($"Unsupported face recognition implementation: {implementation}."); } }) .AddSingleton <IFaceRecognition>(factory => { string implementation = this.Configuration["Face Recognition:Implementation"]; if (implementation == "Azure") { return(new FaceApi(this.Configuration)); } else { throw new NotSupportedException($"Unsupported face recognition implementation: {implementation}."); } }) .AddScoped <IIdentity>(factory => { string implementation = this.Configuration["Identity:Implementation"]; if (implementation == "XML") { IStorage storage = factory.GetService <IStorage>(); IFaceRecognition faceRecognition = factory.GetService <IFaceRecognition>(); return(new XmlIdentity(this.Configuration, faceRecognition, storage)); } else { throw new NotSupportedException($"Unsupported face recognition implementation: {implementation}."); } }) .AddAuthentication(AUTHENTICATION_SCHEME) .AddCookie(AUTHENTICATION_SCHEME, options => { options.AccessDeniedPath = new PathString("/identity/login"); options.ClaimsIssuer = AUTHENTICATION_SCHEME; options.Cookie.Name = "Biometric"; options.Cookie.IsEssential = true; options.Cookie.SecurePolicy = CookieSecurePolicy.None; //options.Cookie.SecurePolicy = _env.IsDevelopment() ? CookieSecurePolicy.SameAsRequest : CookieSecurePolicy.Always; options.ExpireTimeSpan = new TimeSpan(4, 0, 0); options.LoginPath = new PathString("/identity/login"); options.SlidingExpiration = true; }); services .Configure <FormOptions>(options => { options.ValueCountLimit = 25000; }) .AddMvc() .SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }