private void buttonCompare_Click(object sender, EventArgs e) { string libPath = System.Environment.CurrentDirectory + Path.DirectorySeparatorChar + Env.libFolder + Path.DirectorySeparatorChar; if (!Directory.Exists(libPath)) { MessageBox.Show("没有找到数据库 !", "错误"); return; } string[] folders = Directory.GetFileSystemEntries(libPath); textBoxOutput.Clear(); foreach (string singleFolder in folders) { string[] spiltString = new string[1] { Path.DirectorySeparatorChar.ToString() }; string[] items = singleFolder.Split(spiltString, StringSplitOptions.RemoveEmptyEntries); string Name = items[items.Count() - 1]; for (int i = 0; i < nowDetectResult.face.Count; i++) { VerifyResult tempVerifyResult = fs.Recognition_VerifyByName(nowDetectResult.face[i].face_id, Name); if (tempVerifyResult == null) { MessageBox.Show("本地数据库与云端不符!请先将数据同步到云端!", "错误"); return; } ConsoleOutput(tempVerifyResult, Name, i); } } buttonAddToLib.Enabled = false; buttonCompare.Enabled = false; }
private void DefaultStage(DetectResult detectResult) { if (detectResult.face.Count == 1) { VerifyResult person = fs.Recognition_VerifyByName(detectResult.face[0].face_id, userName.Text); status.Content = "Hello " + userName.Text + ", What would you like to do?"; if (person == null) { PersonBasicInfo info = fs.Person_Create(userName.Text, detectResult.face[0].face_id); AsyncResult a = fs.Train_VerifyById(info.person_id); } else { if (!person.is_same_person) { status.Content = "NO! You are not " + userName.Text; } else { lockFile.IsEnabled = true; UnlockFile.IsEnabled = true; Increase.IsEnabled = true; } } } else { status.Content = "No face detected"; } }