Emgucv # 28: Face detection using Cascade Classifiers: Haar and LBP

Поділитися
Вставка
  • Опубліковано 22 гру 2024

КОМЕНТАРІ • 80

  • @nelsonazolukwamprojects
    @nelsonazolukwamprojects 2 роки тому

    Great video! Please any help for face recognition over live webcam?

  • @zuriuszu
    @zuriuszu 2 роки тому

    How can the image be enlarged so both neck and head could be visible?

  • @zuriuszu
    @zuriuszu Рік тому

    Sir, how can i increase face detected red rectangle for more view so both neck and head could be visible?

  • @Music-lv8xf
    @Music-lv8xf 5 років тому +1

    what was the size of every image that you to test the face detection?

  • @santoshikewat9008
    @santoshikewat9008 4 роки тому

    Getting this error - The type initializer for 'Emgu.CV.CvInvoke' threw an exception. after selecting a image

  • @Bioengineer-CSi
    @Bioengineer-CSi 5 років тому

    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.

    • @TechAJX
      @TechAJX  5 років тому

      great

    • @MyGlam-n7b
      @MyGlam-n7b 4 роки тому

      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

  • @shyam8610
    @shyam8610 6 років тому

    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?

  • @dromanx
    @dromanx 6 років тому +2

    I have error: "opencv:! Empty ()". An exception occurs in "Rectangle [] faces = classifierFace.DetectMultiScale (imgGray, 1.1, 3);". How to fix it?

    • @TechAJX
      @TechAJX  6 років тому

      please put a check before applying the detection function that the imgGray is not empty

    • @dromanx
      @dromanx 6 років тому

      imgGray equals {Emgu.CV.Image}. The problem also repeats with your downloaded source code...

    • @mishka251
      @mishka251 6 років тому +2

      I have this problem too.. maybe it problem with rus localisation? Решил как-нибудь? АПДЕЙТ: проблема была в кириллице в пути в проекту, а папка с xml лежала в папке проекта. Перенес проект на С/Projects чтобы не было кириллицы и всё ок. Problem solved.

    • @Superluis125
      @Superluis125 Рік тому

      @@mishka251 I love youuuu, 3 hours and the problem was an ü on the username of the computer.

  • @Mohsiiiiiiinnn
    @Mohsiiiiiiinnn 6 років тому

    Amazing series... Extremely waiting for facial recognition part... Please do it as soon as possible... Thanks !

  • @huggksn4787
    @huggksn4787 6 років тому +2

    there have been two months, I thought you quit sharing videos. Waiting for new videos Dud...

  • @markjohnmejias4460
    @markjohnmejias4460 5 років тому

    How about the lbpcascade_frontalface_improved.xml ?

  • @jonatoledo5158
    @jonatoledo5158 6 років тому

    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?

    • @TechAJX
      @TechAJX  6 років тому

      Hey gerardo, if the transmission delay is say about 5 seconds them make Task.Delay(5000) something like this to simulate the real situation.

    • @jonatoledo5158
      @jonatoledo5158 6 років тому

      I'm new using EmguCV, I'm sorry but I did not understand your recommendation. Can you give me more details?

  • @malithdesilva5870
    @malithdesilva5870 6 років тому +1

    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.

    • @TechAJX
      @TechAJX  6 років тому

      Malith, I never used dlib man :P

    • @malithdesilva5870
      @malithdesilva5870 6 років тому

      Can you suggest any method that I can find face shape? I want to find some ratios of the face using landmarks.

    • @TechAJX
      @TechAJX  6 років тому

      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

    • @malithdesilva5870
      @malithdesilva5870 6 років тому

      Thanks AJ

  • @alanebadreddine1190
    @alanebadreddine1190 6 років тому +1

    Please, will you put more videos?

    • @TechAJX
      @TechAJX  6 років тому

      I ll try Alane :P

    • @alanebadreddine1190
      @alanebadreddine1190 6 років тому

      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 :)

    • @MuhammadBilal-ry5rb
      @MuhammadBilal-ry5rb 6 років тому

      +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 ???

  • @zeeshanliaqat7991
    @zeeshanliaqat7991 5 років тому

    Sir how we can perform facial recognition using emgu cv ?

  • @kariyamvinod
    @kariyamvinod 5 років тому

    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...

  • @lorenalopeznortes5598
    @lorenalopeznortes5598 6 років тому

    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
      @TechAJX  6 років тому

      Hello Lorena,
      What is the actual error?

    • @lorenalopeznortes5598
      @lorenalopeznortes5598 6 років тому

      @@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);"

    • @lorenalopeznortes5598
      @lorenalopeznortes5598 6 років тому

      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 !! :)

  • @doge9203
    @doge9203 4 роки тому

    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?

    • @TechAJX
      @TechAJX  4 роки тому

      i am not sure, if you could share more details of the error stuff then may be i can suggest

    • @doge9203
      @doge9203 4 роки тому

      @@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

    • @doge9203
      @doge9203 4 роки тому

      @@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

    • @TechAJX
      @TechAJX  4 роки тому

      @@doge9203 :P

  • @Daniel.camposcpd
    @Daniel.camposcpd 5 років тому

    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

  • @trongchu2003
    @trongchu2003 6 років тому

    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?

    • @TechAJX
      @TechAJX  6 років тому

      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

  • @huggksn4787
    @huggksn4787 6 років тому

    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.

    • @TechAJX
      @TechAJX  6 років тому

      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

    • @huggksn4787
      @huggksn4787 6 років тому

      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.

  • @amandaseptia9962
    @amandaseptia9962 5 років тому

    sir, how can i know the value of the object detected on that ROI ?

    • @TechAJX
      @TechAJX  5 років тому

      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

  • @bareerahshoukat5404
    @bareerahshoukat5404 5 років тому

    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
      @TechAJX  5 років тому

      Hello Bareerah
      what is the exact error. If you share the error then i ll be able to help you what the error is

    • @bareerahshoukat5404
      @bareerahshoukat5404 5 років тому

      @@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 )"

  • @syedwaqarali7597
    @syedwaqarali7597 6 років тому

    Great Work sir! i Just want to know, which method is useful for Mood Detection Using Facial Expression. Thanks For ur Videos.

    • @TechAJX
      @TechAJX  6 років тому

      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

  • @JaanTechTalks
    @JaanTechTalks 4 роки тому

    Great work sir the great...

  • @ganeshkharde7331
    @ganeshkharde7331 6 років тому

    many thanks for your videos. I am waiting for multiple hand gesture detection Part..... Thanks a lot

  • @ninhngo8564
    @ninhngo8564 6 років тому +1

    many thanks for your videos. I am waiting about recognition method. Thanks a lot

    • @coderock5655
      @coderock5655 6 років тому

      Recognition:
      ua-cam.com/video/VrthLPWB3yg/v-deo.html

  • @dylanmuscat
    @dylanmuscat 6 років тому

    When will the recognition part come out? :)

    • @TechAJX
      @TechAJX  6 років тому

      dylanmuscat, Can we extend the day from 24 hours to somewhere 30 hours, so that I can make it quickly :P :)

    • @dylanmuscat
      @dylanmuscat 6 років тому

      Sadly no :c. Do you have a rough idea when it will be done by any chance?

    • @TechAJX
      @TechAJX  6 років тому

      i ll try in upcoming two week, but not sure

    • @dylanmuscat
      @dylanmuscat 6 років тому

      Tech AJ Thanks keep up the great work

    • @dylanmuscat
      @dylanmuscat 6 років тому

      Any progress on the video?

  • @rabiashah9686
    @rabiashah9686 6 років тому

    have you added the reference of any opencv dll file?

    • @TechAJX
      @TechAJX  6 років тому

      Yup, check emgucv#1

    • @coderock5655
      @coderock5655 6 років тому

      Recognition:
      ua-cam.com/video/VrthLPWB3yg/v-deo.html

  • @carlvincentolmo2408
    @carlvincentolmo2408 6 років тому +1

    thanks for the video...:) waiting for the recognition part...

    • @coderock5655
      @coderock5655 6 років тому

      Recognition:
      ua-cam.com/video/VrthLPWB3yg/v-deo.html

  • @fatimasiddiqui388
    @fatimasiddiqui388 5 років тому

    plz give me also a face recognition code for this

    • @TechAJX
      @TechAJX  5 років тому

      it is just face detection, for face recognition, need to add some classifier too.

    • @fatimasiddiqui388
      @fatimasiddiqui388 5 років тому

      @@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

    • @MyGlam-n7b
      @MyGlam-n7b 4 роки тому

      @@fatimasiddiqui388 hey can u please send me ur code . At bulbulvishwakarma62@gmail.com

  • @muzammal1113
    @muzammal1113 6 років тому

    Good

  • @Siminfrance
    @Siminfrance 6 років тому

    Sorry, but the Audio is terrible... sounds muffled or something.