public static RecognizerResult DetectFromImage(string ImagePath) { RecognizerResult Result = new RecognizerResult(); //Lay moi ten anh, ko lay toan bo duong dan Result.ImageLink = System.IO.Path.GetFileName(ImagePath); if (Haar == null) { Haar = CreateHaar(HaarType.AltTree); } //Chuyen anh trang den roi bat dau recognize, dung using de tu giai phong memories using (Image <Gray, byte> Image = new Image <Gray, byte>(ImagePath)) { var FacesDetected = Image.DetectHaarCascade(Haar, DETECT_SCALE, MIN_NEIGHBOR, 0, new System.Drawing.Size(MIN_SIZE, MIN_SIZE))[0]; foreach (var Face in FacesDetected) { FaceRegion FaceReg = new FaceRegion(Face.rect.X, Face.rect.Y, Face.rect.Width, Face.rect.Height); Result.FaceList.Add(FaceReg); } } return(Result); }
public override bool Equals(Object obj) { // If parameter is null return false. if (obj == null) { return(false); } // If parameter cannot be cast to Point return false. FaceRegion Face = (FaceRegion)obj; if (Face == null) { return(false); } // Return true if the fields match: return((X == Face.X) && (Y == Face.Y) && (Width == Face.Width) && (Height == Face.Height) && (StudentID == Face.StudentID)); }