C# Tutorial - Webcam Face Detection for .NET using EMGU.CV in C# | FoxLearn

Поделиться
HTML-код
  • Опубликовано: 11 дек 2024

Комментарии • 142

  • @koolooc726
    @koolooc726 2 года назад +11

    just a tip for anyone following this tutorial, I had a lot of problems when using the latest versions of EMGU, but then I tried the older versions, such as 3.2 and it worked just fine :3

    • @jabuszkodev
      @jabuszkodev Год назад

      System.TypeInitializationException
      HResult=0x80131534
      Message=Inicjator typów zgłosił wyjątek dla typu 'Engine.Form1'.
      Source=Engine
      Ślad stosu:
      at Engine.Form1..ctor() in C:\Users\Alex\Desktop\Codes\Engine\Engine\Form1.cs:line 23
      at Engine.Program.Main() in C:\Users\Alex\Desktop\Codes\Engine\Engine\Program.cs:line 19
      Ten wyjątek został pierwotnie zgłoszony w tym stosie wywołań:
      [Kod zewnętrzny]
      Engine.Form1.Form1() w Form1.cs
      Wewnętrzny wyjątek 1:
      CvException: OpenCV: haarcascade_frontalface_alt_tree.xml(1): Valid XML should start with ''

    • @حساناليافعي-ق9ذ
      @حساناليافعي-ق9ذ Год назад

      ​@@jabuszkodev🎉

  • @giuliocacucci2856
    @giuliocacucci2856 4 года назад +8

    Hi, great tutorial.
    Thanks a lot!
    Just a little tip for followers: "Use Emgu.CV V4.1.1.3497 (as in the video) to avoid errors with related functions".

    • @foxlearn
      @foxlearn  4 года назад +3

      Thanks for sharing

    • @peterstein4682
      @peterstein4682 4 года назад +1

      Very true

    • @keyboardwarrior2418
      @keyboardwarrior2418 3 года назад +1

      @@foxlearn His comment is very important. The newer version will indeed cause errors. It would be a good idea to pin his comment so that new people watching this video will get a heads-up.

    • @RmzPame
      @RmzPame Год назад

      @@keyboardwarrior2418 doesnt work for me

  • @classiciranian
    @classiciranian 3 года назад

    thank you very much . i'm a iranian programmer and very happy for create a channel for programmers c# . be succesful

  • @talhatariq5530
    @talhatariq5530 4 года назад

    I Really can't express the sense of satisfaction over this Video . Good work and really Helpful .

  • @ameerabdaljabar
    @ameerabdaljabar 5 лет назад +6

    We need a project that compares the face, for example: - You have a group of photos of certain people, the number of thousands, and you take a picture of a modern person, the program compares the new image with the old photos and extracts the old image of his
    I think it's termed "image processing"

    • @foxlearn
      @foxlearn  5 лет назад +3

      OK. Thank you for your suggestion. I'll upload soon !

    • @ameerabdaljabar
      @ameerabdaljabar 4 года назад

      Fox Learn any upload 😅

  • @denisbmonteiro
    @denisbmonteiro 5 лет назад +4

    Good job with the tutorials, there is really cool videos on your channel.
    Would be possible to upload more WPF videos please?

    • @foxlearn
      @foxlearn  5 лет назад +2

      OK. Thank you for your suggestion !

  • @aidanmcgeady7663
    @aidanmcgeady7663 4 года назад

    @FoxLearn is there a way to have 2 different types of boxes come up?
    Say a red box would appear if the image is in a file directory and a blue box if it is not?
    If so how would this be done? If that can't be done, then could you show a way to have a box appear but only on people who the programme has been "trained" to see?

  • @bangsamorodeveloper1506
    @bangsamorodeveloper1506 5 лет назад +5

    Wow! This is a wonderful tutorial... Thank you FoxLearn!
    By the way, is it possible to compare the face from the image saved in the database using that method? If a face was similar on one of the image saved in database, then it will say something! I hope you can make a tutorial for that.😁😊

    • @foxlearn
      @foxlearn  5 лет назад +2

      Let me try to research. Thank you for your suggestion !

    • @TheSuper7777777
      @TheSuper7777777 5 лет назад +1

      Yes please. I need tutorial like this

    • @puppz03
      @puppz03 2 года назад

      @@foxlearn Hi, have you done the code for this? Thanks in advance

  • @sairk6174
    @sairk6174 4 года назад +1

    Seems am bit late in subscribing to your channel ..vids are Awesome ..Thanks A Ton for sharing your knowledge. Actual i would like to know more on communication btw winforms and web browser control (customized with html controls as webpage ) .Any help ..much Appreciated .

  • @mohammadthaher8454
    @mohammadthaher8454 4 года назад

    great video
    is there any video or project for medical face detection using emgu.cv c#?

  • @Дмитрийсекрет-н7о
    @Дмитрийсекрет-н7о 5 лет назад

    Великолепный урок ))

  • @swerytv4342
    @swerytv4342 5 лет назад +1

    Thanks for this tutorial yet. so i am waiting the system login and authorization that you have implement on JRE rental software with Devexpress.

    • @foxlearn
      @foxlearn  5 лет назад +1

      I'll write the article on my site. Too much code i can't make the video tutorial

    • @swerytv4342
      @swerytv4342 5 лет назад

      @@foxlearn I managed to implement login but i could not manage in the authorization and management of the colone role in other to print it in the gridview of Devexpress i am trying but nothing as solutions. Thank you.

    • @swerytv4342
      @swerytv4342 5 лет назад

      @@foxlearn i don't need the video for that just a source code and comment for each line it's all please i am work on a project i would like To implement it.

  • @dhtlucky1984
    @dhtlucky1984 5 лет назад +1

    Perfect! I wish i could like this video 1000 times.
    Do you try with a Decklink card & Professional SDI Camera?

    • @foxlearn
      @foxlearn  5 лет назад

      At this time no. Thank you !

    • @keyboardwarrior2418
      @keyboardwarrior2418 3 года назад

      @@foxlearn What is the song name of the music that starts playing at 8:16? You forgot to mention it in your video description.

  • @spymancrackers
    @spymancrackers 5 лет назад

    Very good tutorial
    Thank you very much

    • @foxlearn
      @foxlearn  5 лет назад +1

      You're welcome. Thank you !

  • @davidcerezoromero375
    @davidcerezoromero375 4 года назад

    So wonderful. Hi, do you know how I can stream the processed content ( the frames with rectangules over the smiles) to a client from a Web Server using emgucv ???

    • @foxlearn
      @foxlearn  4 года назад +1

      OK. Thank you for your suggestion. Let me try to research

  • @RichardDika-kv7yj
    @RichardDika-kv7yj 4 года назад

    Very good tutorial

  • @kamild3
    @kamild3 4 года назад

    Thank you for video. If I want to change video source as my desktop screen, what changes should I do in the code?

    • @foxlearn
      @foxlearn  4 года назад

      Change your picturebox dock to fill

    • @kamild3
      @kamild3 4 года назад

      @@foxlearn I want to capture faces from desktop screen not webcam. Is it gonna work?

  • @wONd3ry
    @wONd3ry 11 месяцев назад

    100% working

  • @septiantriiriawan6531
    @septiantriiriawan6531 5 лет назад +1

    Nice tutorial.. Could you please include your pc specs? Thanks

    • @Misicek
      @Misicek 3 года назад

      why u need that :D

  • @tamhoangminh197
    @tamhoangminh197 2 года назад

    Thankyou so much but I had an problem:
    I downloaded haarcascade_frontalface_alt_tree.xml file in the link github you've share but It still cannot detected my face,
    I added checkpoint that cascadeClassifier.DetectMultiScale(grayImage, 1.2, 1) always return empty array. Help me please

  • @SigmaGamerProzst
    @SigmaGamerProzst 4 года назад +1

    trainer link: github.com/opencv/opencv/blob/master/data/haarcascades/haarcascade_frontalface_alt_tree.xml

  • @Ruhgtfo
    @Ruhgtfo 4 года назад +1

    Thanks is works, but is not sensitive as expected and have mirror effect~
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using AForge.Video;
    using AForge.Video.DirectShow;
    using Emgu.CV;
    using Emgu.CV.Structure;
    namespace FaceDetectionCamera
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }
    FilterInfoCollection filter;
    VideoCaptureDevice device;
    private void Form1_Load(object sender, EventArgs e)
    {
    filter = new FilterInfoCollection(FilterCategory.VideoInputDevice);
    foreach (FilterInfo device in filter)
    cboDevice.Items.Add(device.Name);
    cboDevice.SelectedIndex = 0;
    device = new VideoCaptureDevice();
    }
    private void btnDetect_Click(object sender, EventArgs e)
    {
    device = new VideoCaptureDevice(filter[cboDevice.SelectedIndex].MonikerString);
    device.NewFrame += Device_NewFrame;
    device.Start();
    }
    static readonly CascadeClassifier cascadeClassifier = new CascadeClassifier("haarcascade_frontalface_alt_tree.xml");
    private void Device_NewFrame(object sender, NewFrameEventArgs eventArgs)
    {
    Bitmap bitmap = (Bitmap)eventArgs.Frame.Clone();
    Image grayImage = new Image(bitmap);
    Rectangle[] rectangles = cascadeClassifier.DetectMultiScale(grayImage, 1.2, 1);
    foreach (Rectangle rectangle in rectangles)
    {
    using (Graphics graphics = Graphics.FromImage(bitmap))
    {
    using (Pen pen = new Pen(Color.Red, 1))
    {
    graphics.DrawRectangle(pen, rectangle);
    }
    }
    }
    pic.Image = bitmap;
    }
    private void Form1_FormClosing(object sender, FormClosingEventArgs e)
    {
    if (device.IsRunning)
    device.Stop();
    }
    }
    }

  • @seo.innovativedevelopment9157
    @seo.innovativedevelopment9157 3 года назад +1

    Error CS1503 Argument 1: cannot convert from 'System.Drawing.Bitmap' to 'byte[*,*,*]'

  • @MeloneXT-mh6vg
    @MeloneXT-mh6vg 3 года назад +1

    CS1503 Argument "1": Converting from "System.Drawing.Bitmap" in "byte[*,*,*]" not Possible
    Pls Help

    • @RmzPame
      @RmzPame Год назад

      I replace "Image grayImage = new Image(bitmap)" to "var grayImage = bitmap.ToImage();"
      it works for me

  • @ranniesumacot4576
    @ranniesumacot4576 3 года назад

    Using this face recognition, how do you display the user's information using his face?

  • @abdalrhmanatma3026
    @abdalrhmanatma3026 3 года назад +1

    how i can solve this "cannot convert from 'System.Drawing.Bitmap' to 'byte[*,*,*]'"

    • @ivanestrada2688
      @ivanestrada2688 3 года назад

      Instala la version Emgu.CV 4.1.1.3497 en lugar de la mas nueva

    • @u1krsh
      @u1krsh 2 года назад

      @@ivanestrada2688 Muchas gracias!

  • @thetechchap6260
    @thetechchap6260 3 года назад +1

    everything went perfect but not detecting the face why ??
    can you please help me out

  • @relaxingsatisfying9441
    @relaxingsatisfying9441 5 лет назад

    Amazing.. ..

  • @shahakkuba8590
    @shahakkuba8590 4 года назад

    I've copied the code exactly to see if my errors were spacings or anything little I could miss but I still get the
    Error: CS1503 Argument 1: cannot convert from 'System.Drawing.Bitmap' to 'byte[*,*,*]'

    • @foxlearn
      @foxlearn  4 года назад

      Please check again. You can see demo code at foxlearn.com

    • @lavyksoares9962
      @lavyksoares9962 4 года назад +5

      I analyzed the case and saw that the error happens because of the version of Emgu.cv downloaded on NuGet. You need to downgrade to the version Emgu.cv V4.1.1.3497 on NuGet itself, to solve it for me.

    • @RmzPame
      @RmzPame Год назад +1

      I replace "Image grayImage = new Image(bitmap)" to var "grayImage = bitmap.ToImage();"
      it works for me

  • @daalwada
    @daalwada 4 года назад

    My VideoCaptureDevice in Page Load event is throwing "Object Reference not set" error. How to add the input device in dropdown? (BDW I am creating this application in Laptop)

    • @foxlearn
      @foxlearn  4 года назад

      Please check your code again. I think you miss something

    • @malex1836
      @malex1836 2 года назад

      @Alex Caraballo did you solve it??

  • @khalilsaqib8176
    @khalilsaqib8176 3 года назад

    Please upload video on Face emotion detection

  • @ncankalkan583
    @ncankalkan583 3 года назад

    why dont you give link "haars_frontface_alt_xtree.xml" files for download? :/

  • @danielezekielulep4956
    @danielezekielulep4956 4 года назад

    I have a problem
    "pic.image does not exist in the current context"
    What does pic.image mean?

    • @foxlearn
      @foxlearn  4 года назад

      pic is a name of your PictureBox control

  • @jameelurrehman8587
    @jameelurrehman8587 5 лет назад

    خوب

  • @adorablelaughter4093
    @adorablelaughter4093 5 лет назад

    Thanks for the tutorial. But pls I have a problem, the camera captures images well but it's not detecting the face. I had issues downloading the engine.cv, the one with over 200k download, so I downloaded the one with over 100k download. Could that be the cause?

    • @foxlearn
      @foxlearn  5 лет назад

      What error are you getting?

    • @adorablelaughter4093
      @adorablelaughter4093 5 лет назад

      @@foxlearn it does not throw any exceptions. It builds well, but while capturing the image, it does not detect the face neither does it show any rectangular line.

    • @lawrencekraft106
      @lawrencekraft106 4 года назад

      Have you solved the problem already? It seems I´m having the same issue

    • @marymory28
      @marymory28 4 года назад

      I had the same problem, but I change the library of Emug.CV to EmugCV and if you have another thing, for example --> Image grayImage = new Image(bitmap.Size); it should stay with Image grayImage = new Image(bitmap);

  • @r50142
    @r50142 5 лет назад

    Oh WOW!

  • @jeraldsamonte1264
    @jeraldsamonte1264 4 года назад

    System.TypeInitializationException: 'The type initializer for 'Face_Detection_Camera.Form1' threw an exception.'
    im getting this error hope you can help

    • @foxlearn
      @foxlearn  4 года назад

      Please check your code again. i think you missing something

  • @hieudaica1304
    @hieudaica1304 3 месяца назад

    I managed to make it work somehow but it is not really detect my face as I have expected.

  • @sinhnguyennguyen4329
    @sinhnguyennguyen4329 5 лет назад

    Follow code instruction, it can show webcam but it could not show rectangle on the face. Debug code in frame event, it always returns zero rectangle, so it could not draw red rectangle on the face. What happen to me?

    • @foxlearn
      @foxlearn  5 лет назад

      Select an other picture or you can detect your face via webcam

    • @prometeusz.jasinski
      @prometeusz.jasinski 4 года назад

      @@foxlearn Does not work with my german face either. Facing the cam on the youtube video detects the face there. I guess now I need to dig into openCV...

  • @moussagerges6709
    @moussagerges6709 4 года назад +1

    Thank you very much😊, you can find source code here: github.com/MoussaGerges9/Face-Detection.git

  • @Khaner8
    @Khaner8 4 года назад

    Image grayImage = new Image(bitmap);
    I have an error on the last "bitmap". It says
    Error CS1503 Argument 1: cannot convert from 'System.Drawing.Bitmap' to 'byte[*,*,*]'
    I need Help

    • @juanottaviano4017
      @juanottaviano4017 4 года назад +1

      Latest Emgu.cv version removed the Image(Bitmap bitmap) definition.
      Best solution is to download the exact same version as in the video.(v4.1.1.3497) which still has the Bitmap parameter definition.

    • @Khaner8
      @Khaner8 4 года назад

      @@juanottaviano4017 okie dokie

    • @QutadaAlFannad
      @QutadaAlFannad 4 года назад

      Our Friend solved it
      Lavyk Soares
      Lavyk Soares
      1 month ago (edited)
      I analyzed the case and saw that the error happens because of the version of Emgu.cv downloaded on NuGet. You need to downgrade to the version Emgu.cv V4.1.1.3497 on NuGet itself, to solve it for me.

  • @vungocquang6838
    @vungocquang6838 5 лет назад

    Hi. How to change the server name is PC / SQLEXPRESS to PC. Thanhk you

  • @ohfam6631
    @ohfam6631 4 года назад

    i got this error: cannot convert from 'System.Drawing.Bitmap' to 'byte[*,*,*]' how could i fix this?

    • @foxlearn
      @foxlearn  4 года назад +1

      Please check your code again. I think you miss something

    • @shahakkuba8590
      @shahakkuba8590 4 года назад

      i got the same error did u find out what the issue was?

    • @lavyksoares9962
      @lavyksoares9962 4 года назад +2

      I analyzed the case and saw that the error happens because of the version of Emgu.cv downloaded on NuGet. You need to downgrade to the version Emgu.cv V4.1.1.3497 on NuGet itself, to solve it for me.

    • @daalwada
      @daalwada 4 года назад +1

      @@lavyksoares9962 Thanks Buddy! :) It helped me solve my issue.

    • @rapidengineering2055
      @rapidengineering2055 4 года назад +1

      @@lavyksoares9962 Thanks

  • @ProjectCluster_0
    @ProjectCluster_0 11 месяцев назад

    The downgrade emguCv solution is not working, when I installed it it just made the cascadeclassifier not working saying there's no cascadeclassifier

  • @abdalrhmanatma3026
    @abdalrhmanatma3026 3 года назад

    can i ask you a question

  • @lehong8046
    @lehong8046 5 лет назад

    Great !

  • @desync7
    @desync7 4 года назад

    Webcam person detection?

  • @abmtechnologies
    @abmtechnologies 5 лет назад +1

    sorry Sir but I don't Understand what is "cdoDevice"

  • @ShakirAlimit
    @ShakirAlimit 4 года назад

    EMGU.CV is open source ?

    • @foxlearn
      @foxlearn  4 года назад

      Yes, It's an opensource

  • @leinah3671
    @leinah3671 4 года назад

    is object detection included?

  • @braydencunningham9337
    @braydencunningham9337 5 лет назад

    So, i'm having a problem on line 29 where it says "
    Error CS1061 'VideoCaptureDevice' does not contain a definition for 'name' and no accessible extension method 'name' accepting a first argument of type 'VideoCaptureDevice' could be found (are you missing a using directive or an assembly reference?)"
    but I don't know how to fix it

    • @foxlearn
      @foxlearn  4 года назад

      You should install the libraries, and don't forget to include to your namespace

  • @raresh1272
    @raresh1272 3 года назад

    why it doesn't detect my camera? please help

  • @atsmv2964
    @atsmv2964 2 года назад +1

    private void Device_NewFrame(object sender, NewFrameEventArgs eventArgs)
    {
    Bitmap bitmap = (Bitmap)eventArgs.Frame.Clone();
    //Image grayImage = new Image(bitmap);
    //GraphicsImage = Image.FromFile(openfiledialog1.FileName) as Bitmap;
    Image grayImage = new Image(bitmap);
    i have problem at code here:
    Image grayImage = new Image(bitmap);
    the error is at (bitmap)
    the error is : Error CS1503 Argument 1: cannot convert from 'System.Drawing.Bitmap' to 'byte[*,*,*]'

    • @akhilan8293
      @akhilan8293 2 года назад

      I'm also have this error

    • @FereshtehJourney
      @FereshtehJourney 2 года назад

      I have the same error! I can't install the downgrade version because I am coding in .NET core 3.1, please help me to solve it

  • @yourspdahal5606
    @yourspdahal5606 4 года назад

    can i use it my own system

    • @foxlearn
      @foxlearn  4 года назад

      Yes, you can

    • @yourspdahal5606
      @yourspdahal5606 4 года назад

      ​@@foxlearn may i use haarcascade_frontalface_alt2.xml file for development of software and distribution it. how can i use this Copyright (C) 2000, Intel Corporation, please help me . Thank you!!!

  • @hambalilubis361
    @hambalilubis361 5 лет назад +1

    Real time detection please

    • @foxlearn
      @foxlearn  5 лет назад +1

      Thank you for your suggestion !

  • @SigmaGamerProzst
    @SigmaGamerProzst 4 года назад

    4:05 please ignore this comment

  • @Dione5G
    @Dione5G 2 года назад

    I love you

  • @ogunkilic2625
    @ogunkilic2625 5 лет назад +1

    github.com/opencv/opencv/tree/master/data/haarcascades
    Github link

  • @aamirgour3604
    @aamirgour3604 3 года назад

    Not working properly

  • @The_Sifter
    @The_Sifter 4 года назад

    github link is 404 error

    • @prometeusz.jasinski
      @prometeusz.jasinski 4 года назад

      github.com/opencv/opencv/blob/master/data/haarcascades/haarcascade_frontalface_alt_tree.xml in my case I forgot to type twice "opencv"

  • @alirezaabedi1885
    @alirezaabedi1885 5 лет назад

    like.

  • @mohammedmuzzammil1184
    @mohammedmuzzammil1184 Год назад

    private void Device_NewFrame(object sender, NewFrameEventArgs eventArgs)
    {
    Bitmap bitmap = (Bitmap)eventArgs.Frame.Clone();
    Image grayscale = new Image(bitmap);
    Rectangle[] rectangles = cascadeClassifier.DetectMultiScale(grayscale, 1.2, 1);
    foreach (Rectangle rectangle in rectangles)
    {
    using(Graphics graphics=Graphics.FromImage(bitmap))
    {
    using(Pen pen=new Pen(Color.Red,1))
    {
    graphics.DrawRectangle(pen, rectangle);
    }
    }
    }
    pictureBox1.Image = bitmap;
    }
    this event is not triggering

  • @莫逆逼
    @莫逆逼 5 лет назад

    redline disapear >

  • @redev4781
    @redev4781 5 лет назад

    pleas taining c# face compare

    • @foxlearn
      @foxlearn  5 лет назад

      OK. Thank you for your suggestion !

  • @vib_yt9806
    @vib_yt9806 2 года назад

    It says cbodevice not found

  • @ivanarabome4172
    @ivanarabome4172 3 года назад

    Wrong.... not accurate in detection and very slow

  • @seo.innovativedevelopment9157
    @seo.innovativedevelopment9157 3 года назад +2

    Error CS1503 Argument 1: cannot convert from 'System.Drawing.Bitmap' to 'byte[*,*,*]'

    • @gogakakabadze
      @gogakakabadze 3 года назад

      **** Solution ****
      Install EmguCV instead of EMGU.CV !!!
      **** Solution****
      That worked for me!

    • @gogakakabadze
      @gogakakabadze 3 года назад

      Do not forget to delete Emgu.CV before or after you install EmguCV!!!!!