Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void btnProcess_Click(object sender, EventArgs e)
- {
- txtProgress.AppendText("Face Detect..." + Environment.NewLine);
- List<Face> faces = faceAPI.FaceDetect(txtFrameImage.Text);
- txtProgress.AppendText("Find Similar..." + Environment.NewLine);
- foreach (var f in faces)
- {
- List<SimilarFace> similarFaces = faceAPI.FaceFindSimilar(f.FaceId, txtFindSimilarFaceListId.Text);
- if(similarFaces.Count == 0)
- {
- txtProgress.AppendText("Croping image..." + f.FaceId + Environment.NewLine);
- imageProcess.CropSingleFace(txtFrameImage.Text, f);
- txtProgress.AppendText("Adding image..." + f.FaceId + Environment.NewLine);
- string faceId = faceAPI.FaceListAddFace(f.FaceId + ".jpg", txtFindSimilarFaceListId.Text);
- File.Move(Path.Combine(facePath, f.FaceId + ".jpg"), Path.Combine(facePath, faceId + ".jpg"));
- db.AddPerson(new Person()
- {
- Id = faceId,
- Filename = faceId + ".jpg",
- Name = "n1",
- Company = "c1",
- Designation = "d1"
- });
- txtProgress.AppendText("----------------" + Environment.NewLine);
- txtProgress.AppendText(faceId + Environment.NewLine);
- txtProgress.AppendText("----------------" + Environment.NewLine);
- }
- else
- {
- foreach (var sf in similarFaces)
- {
- if(sf.Confidence < 0.5)
- {
- //Add
- }
- }
- }
- }
- txtProgress.AppendText("Completed..." + Environment.NewLine);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement