Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foreach (var eye in eyes)
- {
- var e = eye;
- e.X += face.X;
- e.Y += face.Y;
- }
- //gets paths to haash files
- string facePath = Path.GetFullPath(@"../../../datalol/haarcascade_frontalface_default.xml");
- string eyePath = Path.GetFullPath(@"../../../datalol/haarcascade_eye.xml");
- //sets classifiers for face and eye detection
- CascadeClassifier classifierFace = new CascadeClassifier(facePath);
- CascadeClassifier classifierEye = new CascadeClassifier(eyePath);
- var imgGray = imgInput.Convert<Gray, byte>().Clone();
- Rectangle[] faces = classifierFace.DetectMultiScale(imgGray, 1.1, 6);
- foreach (var face in faces)
- {
- imgInput.Draw(face, new Bgr(0, 0, 255), 2);
- imgGray.ROI = face;
- Rectangle[] eyes = classifierEye.DetectMultiScale(imgGray, 1.1, 6);
- foreach (var eye in eyes)
- {
- var e = eye;
- e.X += face.X;
- e.Y += face.Y;
- }
- }
Add Comment
Please, Sign In to add comment