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

Поділитися
Вставка
  • Опубліковано 21 гру 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 2 роки тому

      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 😅

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

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

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

  • @Дмитрийсекрет-н7о
    @Дмитрийсекрет-н7о 5 років тому

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

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

  • @seo.innovativedevelopment9157
    @seo.innovativedevelopment9157 4 роки тому +1

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

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

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

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

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

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

  • @ranniesumacot4576
    @ranniesumacot4576 3 роки тому

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

  • @ncankalkan583
    @ncankalkan583 3 роки тому

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

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

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

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

    Very good tutorial
    Thank you very much

    • @foxlearn
      @foxlearn  5 років тому +1

      You're welcome. Thank you !

  • @thetechchap6260
    @thetechchap6260 3 роки тому +1

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

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

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

  • @wONd3ry
    @wONd3ry 11 місяців тому

    100% working

  • @hieudaica1304
    @hieudaica1304 3 місяці тому

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

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

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

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

  • @RichardDika-kv7yj
    @RichardDika-kv7yj 5 років тому

    Very good tutorial

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

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

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

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

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

    Webcam person detection?

  • @septiantriiriawan6531
    @septiantriiriawan6531 5 років тому +1

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

    • @Misicek
      @Misicek 3 роки тому

      why u need that :D

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

    is object detection included?

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

  • @raresh1272
    @raresh1272 3 роки тому

    why it doesn't detect my camera? please help

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

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

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

    Great !

  • @abmtechnologies
    @abmtechnologies 5 років тому +1

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

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

    Oh WOW!

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

    Amazing.. ..

  • @abdalrhmanatma3026
    @abdalrhmanatma3026 3 роки тому

    can i ask you a question

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

    EMGU.CV is open source ?

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

      Yes, It's an opensource

  • @Ruhgtfo
    @Ruhgtfo 5 років тому +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();
    }
    }
    }

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

  • @SigmaGamerProzst
    @SigmaGamerProzst 4 роки тому +1

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

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

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

  • @atsmv2964
    @atsmv2964 3 роки тому +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

  • @khalilsaqib8176
    @khalilsaqib8176 3 роки тому

    Please upload video on Face emotion detection

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

    خوب

  • @moussagerges6709
    @moussagerges6709 4 роки тому +1

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

  • @hambalilubis361
    @hambalilubis361 5 років тому +1

    Real time detection please

    • @foxlearn
      @foxlearn  5 років тому +1

      Thank you for your suggestion !

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

    I love you

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

  • @ogunkilic2625
    @ogunkilic2625 5 років тому +1

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

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

    4:05 please ignore this comment

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

    It says cbodevice not found

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

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

    pleas taining c# face compare

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

      OK. Thank you for your suggestion !

  • @ivanarabome4172
    @ivanarabome4172 3 роки тому

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

  • @莫逆逼
    @莫逆逼 5 років тому

    redline disapear >

  • @seo.innovativedevelopment9157
    @seo.innovativedevelopment9157 4 роки тому +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!!!!!