Advertisement
sandunfx

Untitled

Mar 21st, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.01 KB | None | 0 0
  1.  private void btnProcess_Click(object sender, EventArgs e)
  2.         {
  3.             txtProgress.AppendText("Face Detect..." + Environment.NewLine);
  4.  
  5.             List<Face> faces =  faceAPI.FaceDetect(txtFrameImage.Text);
  6.  
  7.             txtProgress.AppendText("Find Similar..." + Environment.NewLine);
  8.  
  9.             foreach (var f in faces)
  10.             {
  11.                 List<SimilarFace> similarFaces = faceAPI.FaceFindSimilar(f.FaceId, txtFindSimilarFaceListId.Text);
  12.  
  13.                 if(similarFaces.Count == 0)
  14.                 {
  15.                     txtProgress.AppendText("Croping image..." + f.FaceId +  Environment.NewLine);
  16.  
  17.                     imageProcess.CropSingleFace(txtFrameImage.Text, f);
  18.  
  19.                     txtProgress.AppendText("Adding image..." + f.FaceId + Environment.NewLine);
  20.  
  21.                     string faceId = faceAPI.FaceListAddFace(f.FaceId + ".jpg", txtFindSimilarFaceListId.Text);
  22.  
  23.                     File.Move(Path.Combine(facePath, f.FaceId + ".jpg"), Path.Combine(facePath, faceId + ".jpg"));
  24.  
  25.                     db.AddPerson(new Person()
  26.                     {
  27.                         Id = faceId,
  28.                         Filename = faceId + ".jpg",
  29.                         Name = "n1",
  30.                         Company = "c1",
  31.                         Designation = "d1"
  32.                     });
  33.  
  34.                     txtProgress.AppendText("----------------" + Environment.NewLine);
  35.                     txtProgress.AppendText(faceId + Environment.NewLine);
  36.                     txtProgress.AppendText("----------------" + Environment.NewLine);
  37.  
  38.                 }
  39.                 else
  40.                 {
  41.                     foreach (var sf in similarFaces)
  42.                     {
  43.                         if(sf.Confidence < 0.5)
  44.                         {
  45.                             //Add
  46.                            
  47.                         }
  48.                     }
  49.                 }
  50.  
  51.             }
  52.  
  53.             txtProgress.AppendText("Completed..." + Environment.NewLine);
  54.  
  55.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement