Good Job. I wrote some facial and eye tracking software using the same principle and used a PIC controlled servo motor to track facial movement. I will be uploading my project soon. Nice tutorial.
Sir I'm pursuing bachelor of information technology , I m working on a project name is real time face detection and recognition for security purpose . Sir please help me
Great Video. I am working on something for which I would like to use the same concept of face detection but to detect objects. Objects that have a certain hierarchy of features like in a face( eyes, nose and mouth). How can I create a dataset (XML file(s)) as used here for the purpose of my application?
I have this problem too.. maybe it problem with rus localisation? Решил как-нибудь? АПДЕЙТ: проблема была в кириллице в пути в проекту, а папка с xml лежала в папке проекта. Перенес проект на С/Projects чтобы не было кириллицы и всё ок. Problem solved.
Hi... Excellent video. I would like you to complement this video, with a second part, but using IP cameras. I am trying to save the detected faces, but I have not been successful, since the transmission has a delay of +/- 5 seconds, likewise when I add the line code "cascadeClassifier.DetectMultiScale (grayframe, 1.1, 10, Size.Empty);" increase the delay. Any clue to solve it?
I really appreciated what you are doing through this video series. If you can do a video on delib face landmark detection that will really help us.I couldn't find any source which can detect face landmarks using emgucv. If you have any source, please share with us.
Thank you so much, I asked you because your video helped me a lot, please I need the one of face reconnecting as soon as possible you can, thanks for you again :)
+Tech AJ Sir I have a question I want to detect faces from the Forensic Sketches so which algorithms is best for it recently I used Cascades Classifiers and it works but I want to detect sketch faces by Landmark method but I don't know that this algorithms will works for Sketch faces or not kindly guide me ???
Great Work Sir... Appreciate your effort and time for these videos. I am a new comer in Face Recognition and I want to know what is the best method for face recognition from multiple IP Cameras and from Saved Videos. I want to recognize faces from real time multiple IP Camera Video or from Saved video by comparing saved images in my folder. Please suggest and give any reference if available. Thanks in advance...
Hi, I have an error, an exception occurs in "Rectangle [] faces = classifierFace.DetectMultiScale (imgGray, 1.1, 3); and I have already added a condition to check that ImgGray is not empty. Furthermore, I am from Spain, so I dont think it is a problem with localisation. Could you help me, please?
@@TechAJX, the exception that the visual studio shows is "opencv:! Empty ()". And when I debug it line by line, the line that makes the error appear I think is "Rectangle [] faces = classifierFace.DetectMultiScale (imgGray, 1.1, 3);"
It was just a problem with the haarcascade file I was using. It already works perfectly. Thank you so much for your video tutorials, they have been very helpful for me !! :)
enão consegui fazer o projeto, esta dando erro nessa linha: CascadeClassifier classifierFace = new CascadeClassifier(facePath); Classificador CascadeClassifierEye = new CascadeClassifier (eyePath); poderia me passa o projeto inteiro para que eu possa verificar melhor
I followed your instructions but somehow when I ran the program did not pop up the windowform at first add is FormFaceDetection, but it showed a new window form called form1. So how do I handle it?
I got a problem, not about emgu but could not found an answer on net. Shortly question is this: I take image from camera and the image is at mainform. I added a class to my project for processing images. How can I carry this image into my class and after processing send it back? I tried a few ways and faced wierd problems. Any help is appreciated.
Hakki, It is super duper easy and one easy way to do it is as follows. Suppose you have a class called HelperClass whose .cs file looks like this using system .. .. using Emgu.CV; using Emgu.CV.Structure Class HelperClass { public static Image ForKeskinFunction(Image img) { //do you processing and return an image } } and the form where you can call it as follows: var testimage = new Image(imagepath); var result = HelperClass.ForKeskinFunction(testimage); chills
amanda, can you explain what you mean by value? if there is an object there is possible that the object have many pixels and can have diffierent values.. if you have labeled the object then using the location (x,y) corrdinates of that pixel you can read the value
Can you help me, I am getting an error on cascade classifier and I have imported the files, even tried to change the properties from .net framwork4 but still having error?
@@TechAJX The error is on cascade classifier. It says (Cascade Classifier couldnot be found are you missing directive or assembly reference) If I change cascadeclassifier into Haarcascade then it is giving me error on "DetectMultiScale (img,1.1,4 )"
Waqar, Using machine learning methods you can achieve the desired task. This requires you traing the classifier with the moods that you want to classify. Moreover, as this kind of tasks are not easy to perform, so you have to try different methods and select the one that gives you good results. regards
@@TechAJX sir, thankyou for your rply, actually i am facing a problem in my train and predict method for face recognition. i hv done my face detection through webcam but in recognition , i'm using eigenfacerecognizer algo, my picture saved in the dataset but can not recognize. here is my code:using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Reflection.Emit; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Emgu.CV; using Emgu.CV.CvEnum; using Emgu.CV.Face; //using Emgu.CV.Face; using Emgu.CV.Structure; namespace WindowsFormsApp4 { public partial class Form1 : Form { Image result; Image TrainedFace = null; List trainingImages = new List(); List labels = new List(); List users = new List(); List temp = new List(); Image Frame; Image imgGray = null; int Count, Numlables, t; string name, names = null; Image img;//d private VideoCapture capture;//d private object faceRecognizer; private object recognizeFilePath; private bool _IsTrained; public int Eigen_Distance { get; private set; } public Form1() { InitializeComponent();//d Run();//d try { string facePath = Path.GetFullPath(@"../../data/haarcascade_frontalface_default.xml");//d string eyePath = Path.GetFullPath(@"../../data/haarcascade_eye.xml");//d CascadeClassifier classifierFace = new CascadeClassifier(facePath);//d CascadeClassifier classifierEye = new CascadeClassifier(eyePath);//d string labelsinf = File.ReadAllText(Application.StartupPath + "/Faces/faces.txt"); string[] Labels = labelsinf.Split(',');
// the first label before, will be the number of faces saved. Numlables = Convert.ToInt16(Labels[0]); Count = Numlables; string FacesLoad; for (int i = 0; i < Numlables; i++) { FacesLoad = "face" + i + ".bmp"; trainingImages.Add(new Image(Application.StartupPath + "/Faces/faces.txt")); labels.Add(Labels[i]);
Great video! Please any help for face recognition over live webcam?
How can the image be enlarged so both neck and head could be visible?
Sir, how can i increase face detected red rectangle for more view so both neck and head could be visible?
what was the size of every image that you to test the face detection?
Getting this error - The type initializer for 'Emgu.CV.CvInvoke' threw an exception. after selecting a image
Good Job. I wrote some facial and eye tracking software using the same principle and used a PIC controlled servo motor to track facial movement. I will be uploading my project soon. Nice tutorial.
great
Sir I'm pursuing bachelor of information technology , I m working on a project name is real time face detection and recognition for security purpose .
Sir please help me
Great Video.
I am working on something for which I would like to use the same concept of face detection but to detect objects. Objects that have a certain hierarchy of features like in a face( eyes, nose and mouth). How can I create a dataset (XML file(s)) as used here for the purpose of my application?
I have error: "opencv:! Empty ()". An exception occurs in "Rectangle [] faces = classifierFace.DetectMultiScale (imgGray, 1.1, 3);". How to fix it?
please put a check before applying the detection function that the imgGray is not empty
imgGray equals {Emgu.CV.Image}. The problem also repeats with your downloaded source code...
I have this problem too.. maybe it problem with rus localisation? Решил как-нибудь? АПДЕЙТ: проблема была в кириллице в пути в проекту, а папка с xml лежала в папке проекта. Перенес проект на С/Projects чтобы не было кириллицы и всё ок. Problem solved.
@@mishka251 I love youuuu, 3 hours and the problem was an ü on the username of the computer.
Amazing series... Extremely waiting for facial recognition part... Please do it as soon as possible... Thanks !
there have been two months, I thought you quit sharing videos. Waiting for new videos Dud...
How about the lbpcascade_frontalface_improved.xml ?
Hi... Excellent video. I would like you to complement this video, with a second part, but using IP cameras. I am trying to save the detected faces, but I have not been successful, since the transmission has a delay of +/- 5 seconds, likewise when I add the line code "cascadeClassifier.DetectMultiScale (grayframe, 1.1, 10, Size.Empty);" increase the delay. Any clue to solve it?
Hey gerardo, if the transmission delay is say about 5 seconds them make Task.Delay(5000) something like this to simulate the real situation.
I'm new using EmguCV, I'm sorry but I did not understand your recommendation. Can you give me more details?
I really appreciated what you are doing through this video series. If you can do a video on delib face landmark detection that will really help us.I couldn't find any source which can detect face landmarks using emgucv. If you have any source, please share with us.
Malith, I never used dlib man :P
Can you suggest any method that I can find face shape? I want to find some ratios of the face using landmarks.
Try using dlib for this. But it has no interface for c#. But you can call functions of c++ from c#. For that you need to do some programming :P
Thanks AJ
Please, will you put more videos?
I ll try Alane :P
Thank you so much, I asked you because your video helped me a lot, please I need the one of face reconnecting as soon as possible you can, thanks for you again :)
+Tech AJ Sir I have a question I want to detect faces from the Forensic Sketches so which algorithms is best for it recently I used Cascades Classifiers and it works but I want to detect sketch faces by Landmark method but I don't know that this algorithms will works for Sketch faces or not kindly guide me ???
Sir how we can perform facial recognition using emgu cv ?
Great Work Sir... Appreciate your effort and time for these videos. I am a new comer in Face Recognition and I want to know what is the best method for face recognition from multiple IP Cameras and from Saved Videos. I want to recognize faces from real time multiple IP Camera Video or from Saved video by comparing saved images in my folder. Please suggest and give any reference if available. Thanks in advance...
Hi, I have an error, an exception occurs in "Rectangle [] faces = classifierFace.DetectMultiScale (imgGray, 1.1, 3);
and I have already added a condition to check that ImgGray is not empty. Furthermore, I am from Spain, so I dont think it is a problem with localisation. Could you help me, please?
Hello Lorena,
What is the actual error?
@@TechAJX, the exception that the visual studio shows is "opencv:! Empty ()".
And when I debug it line by line, the line that makes the error appear I think is
"Rectangle [] faces = classifierFace.DetectMultiScale (imgGray, 1.1, 3);"
It was just a problem with the haarcascade file I was using. It already works perfectly. Thank you so much for your video tutorials, they have been very helpful for me !! :)
I made a custom haar cascade that works well in python opencv, but doesn't work in emgucv, do you know how to fix that please?
i am not sure, if you could share more details of the error stuff then may be i can suggest
@@TechAJX actually that is my problem, there is no error, just 0 items found using detectmultiscale, I even tuned the minimum neighbors down to 0
@@TechAJX nevermind man, thank you for noticing my comment, I'll stick with python on this one, I can't really make it work on emgucv
@@doge9203 :P
enão consegui fazer o projeto, esta dando erro nessa linha:
CascadeClassifier classifierFace = new CascadeClassifier(facePath);
Classificador CascadeClassifierEye = new CascadeClassifier (eyePath);
poderia me passa o projeto inteiro para que eu possa verificar melhor
???
@@TechAJX :-)
I followed your instructions but somehow when I ran the program did not pop up the windowform at first add is FormFaceDetection, but it showed a new window form called form1. So how do I handle it?
please check in the program.cs file you create object for FormFaceDectection and pass it to Run method. I guess you create object for Form1
I got a problem, not about emgu but could not found an answer on net. Shortly question is this: I take image from camera and the image is at mainform. I added a class to my project for processing images. How can I carry this image into my class and after processing send it back? I tried a few ways and faced wierd problems. Any help is appreciated.
Hakki, It is super duper easy and one easy way to do it is as follows. Suppose you have a class called HelperClass whose .cs file looks like this
using system
..
..
using Emgu.CV;
using Emgu.CV.Structure
Class HelperClass
{
public static Image ForKeskinFunction(Image img)
{
//do you processing and return an image
}
}
and the form where you can call it as follows:
var testimage = new Image(imagepath);
var result = HelperClass.ForKeskinFunction(testimage);
chills
Thanks for quick and clear response. I could handled by your help. My problem is that I have less knowledge about using "static". Thank you again.
sir, how can i know the value of the object detected on that ROI ?
amanda, can you explain what you mean by value? if there is an object there is possible that the object have many pixels and can have diffierent values.. if you have labeled the object then using the location (x,y) corrdinates of that pixel you can read the value
Can you help me, I am getting an error on cascade classifier and I have imported the files, even tried to change the properties from .net framwork4 but still having error?
Hello Bareerah
what is the exact error. If you share the error then i ll be able to help you what the error is
@@TechAJX The error is on cascade classifier. It says (Cascade Classifier couldnot be found are you missing directive or assembly reference) If I change cascadeclassifier into Haarcascade then it is giving me error on "DetectMultiScale (img,1.1,4 )"
Great Work sir! i Just want to know, which method is useful for Mood Detection Using Facial Expression. Thanks For ur Videos.
Waqar, Using machine learning methods you can achieve the desired task. This requires you traing the classifier with the moods that you want to classify. Moreover, as this kind of tasks are not easy to perform, so you have to try different methods and select the one that gives you good results.
regards
Great work sir the great...
many thanks for your videos. I am waiting for multiple hand gesture detection Part..... Thanks a lot
many thanks for your videos. I am waiting about recognition method. Thanks a lot
Recognition:
ua-cam.com/video/VrthLPWB3yg/v-deo.html
When will the recognition part come out? :)
dylanmuscat, Can we extend the day from 24 hours to somewhere 30 hours, so that I can make it quickly :P :)
Sadly no :c. Do you have a rough idea when it will be done by any chance?
i ll try in upcoming two week, but not sure
Tech AJ Thanks keep up the great work
Any progress on the video?
have you added the reference of any opencv dll file?
Yup, check emgucv#1
Recognition:
ua-cam.com/video/VrthLPWB3yg/v-deo.html
thanks for the video...:) waiting for the recognition part...
Recognition:
ua-cam.com/video/VrthLPWB3yg/v-deo.html
plz give me also a face recognition code for this
it is just face detection, for face recognition, need to add some classifier too.
@@TechAJX sir, thankyou for your rply, actually i am facing a problem in my train and predict method for face recognition. i hv done my face detection through webcam but in recognition , i'm using eigenfacerecognizer algo, my picture saved in the dataset but can not recognize. here is my code:using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.Face;
//using Emgu.CV.Face;
using Emgu.CV.Structure;
namespace WindowsFormsApp4
{
public partial class Form1 : Form
{
Image result;
Image TrainedFace = null;
List trainingImages = new List();
List labels = new List();
List users = new List();
List temp = new List();
Image Frame;
Image imgGray = null;
int Count, Numlables, t;
string name, names = null;
Image img;//d
private VideoCapture capture;//d
private object faceRecognizer;
private object recognizeFilePath;
private bool _IsTrained;
public int Eigen_Distance { get; private set; }
public Form1()
{
InitializeComponent();//d
Run();//d
try
{
string facePath = Path.GetFullPath(@"../../data/haarcascade_frontalface_default.xml");//d
string eyePath = Path.GetFullPath(@"../../data/haarcascade_eye.xml");//d
CascadeClassifier classifierFace = new CascadeClassifier(facePath);//d
CascadeClassifier classifierEye = new CascadeClassifier(eyePath);//d
string labelsinf = File.ReadAllText(Application.StartupPath + "/Faces/faces.txt");
string[] Labels = labelsinf.Split(',');
// the first label before, will be the number of faces saved.
Numlables = Convert.ToInt16(Labels[0]);
Count = Numlables;
string FacesLoad;
for (int i = 0; i < Numlables; i++)
{
FacesLoad = "face" + i + ".bmp";
trainingImages.Add(new Image(Application.StartupPath + "/Faces/faces.txt"));
labels.Add(Labels[i]);
}
}
catch (Exception ex)
{
MessageBox.Show("Nothing in the database");
}
}
private void Run()
{
try
{
capture =new VideoCapture();
capture.QueryFrame();//d
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);//d
return;
}
Application.Idle += ProcessFrame; //d
}
private void saveButton_Click(object sender, EventArgs e)
{
string facePath = Path.GetFullPath(@"../../data/haarcascade_frontalface_default.xml");
string eyePath = Path.GetFullPath(@"../../data/haarcascade_eye.xml");
CascadeClassifier classifierFace = new CascadeClassifier(facePath);
CascadeClassifier classifierEye = new CascadeClassifier(eyePath);
Count = Count + 1;
Frame = capture.QueryFrame().ToImage();
imgGray = Frame.Convert().Clone();
Rectangle[] faces = classifierFace.DetectMultiScale(imgGray, 1.1, 4);
foreach (var face in faces)
{
TrainedFace = Frame.Copy(face).Convert();
Frame.Draw(face, new Bgr(0, 0, 255), 2);
imgGray.ROI = face;
break;
}
// TrainedFace = result.Resize(100, 100, Inter.Cubic);///
TrainedFace = Frame.Convert().Resize(100, 100, Inter.Cubic);
trainingImages.Add(TrainedFace);
labels.Add(textName.Text);
File.WriteAllText(Application.StartupPath + "/Faces/faces.txt", trainingImages.ToArray().Length.ToString() + ",");
for (int i = 1; i < trainingImages.ToArray().Length + 1; i++)
{
trainingImages.ToArray()[i - 1].Save(Application.StartupPath + "/Faces/face" + i + ".bmp");
File.AppendAllText(Application.StartupPath + "/Faces/faces.txt", labels.ToArray()[i - 1] + ",");
}
MessageBox.Show(textName.Text + "Added Successfully");
}
private void ProcessFrame(object sender, EventArgs e)
{
users.Add("");
DetectFaceHaar();
}
private void DetectFaceHaar()
{
string facePath = Path.GetFullPath(@"../../data/haarcascade_frontalface_default.xml");//d
string eyePath = Path.GetFullPath(@"../../data/haarcascade_eye.xml");//d
CascadeClassifier classifierFace = new CascadeClassifier(facePath);//d
CascadeClassifier classifierEye = new CascadeClassifier(eyePath);//d
Frame = capture.QueryFrame().ToImage();//d
imgGray = Frame.Convert().Clone();//d
Rectangle[] faces = classifierFace.DetectMultiScale(imgGray, 1.1, 4);//d
foreach (var face in faces)//d
{
// Frame.Draw(face, new Bgr(0, 0, 255), 2);//d
result = Frame.Copy(face).Convert().Resize(100, 100, Inter.Cubic);
Frame.Draw(face, new Bgr(System.Drawing.Color.Green), 3);
imgGray.ROI = face;//d
if (trainingImages.ToArray().Length != 0)
{
MCvTermCriteria trermCriterias = new MCvTermCriteria(Count, 0.001);
EigenFaceRecognizer recognizer = new EigenFaceRecognizer(80, double.PositiveInfinity);
temp = labels.Select(int.Parse).ToList();
recognizer.Train(trainingImages.ToArray(), temp.ToArray());
// error line
var dd = recognizer.Predict(result);
error line
// string name = Recognise(result);
//var dd =recognizer.Predict(result);
// Console Readkey("fatima");
Frame.Draw(dd.ToString(), new Point(face.X - 2, face.Y - 2), FontFace.HersheyComplex, 0.5,
new Bgr(0, 0, 255), 1, LineType.EightConnected);
// Frame.Draw(name, FontFace.HersheyComplex, 0.5, new Point(face.X - 2, face.Y - 2), new Bgr(Color.Red));
/* Frame.Draw(face, new Bgr(0, 0, 255), 2);
* if (name == "Unknown")
{
Frame.Draw(face, new Bgr(Color.Red), 3);
MessageBox.Show("Face Name is: " + name.ToString());
Frame.Draw(name, new Point(face.X - 2, face.Y - 2), FontFace.HersheyComplex, 0.5,
new Bgr(0, 0, 255), 1, LineType.EightConnected);
}
else
{
Frame.Draw(face, new Bgr(Color.Green), 3);
MessageBox.Show("Face Name is: " + name.ToString());
Frame.Draw(name, new Point(face.X - 2, face.Y - 2), FontFace.HersheyComplex, 0.5,
new Bgr(0, 255, 0), 1, LineType.EightConnected);
}
*/
}
users.Add("");
}
imageBox1.Image = Frame;//d
names = "";
users.Clear();
}
/* private string Recognise(Image result)
{
returm ""
}*/
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
plz help me sir , thanku
@@fatimasiddiqui388 hey can u please send me ur code . At bulbulvishwakarma62@gmail.com
Good
Sorry, but the Audio is terrible... sounds muffled or something.