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
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 ''
@@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.
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 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?
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
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.😁😊
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 ???
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[*,*,*]'
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.
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)
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 .
@@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.
@@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.
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.
System.TypeInitializationException: 'The type initializer for 'Face_Detection_Camera.Form1' threw an exception.' im getting this error hope you can help
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 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.
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);
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
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.
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.
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 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...
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
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(); } } }
@@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!!!
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[*,*,*]'
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
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 ''
@@jabuszkodev🎉
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".
Thanks for sharing
Very true
@@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.
@@keyboardwarrior2418 doesnt work for me
thank you very much . i'm a iranian programmer and very happy for create a channel for programmers c# . be succesful
I Really can't express the sense of satisfaction over this Video . Good work and really Helpful .
Thank you !
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"
OK. Thank you for your suggestion. I'll upload soon !
Fox Learn any upload 😅
@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?
Good job with the tutorials, there is really cool videos on your channel.
Would be possible to upload more WPF videos please?
OK. Thank you for your suggestion !
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
Великолепный урок ))
Thank you !
Thank you for video. If I want to change video source as my desktop screen, what changes should I do in the code?
Change your picturebox dock to fill
@@foxlearn I want to capture faces from desktop screen not webcam. Is it gonna work?
Error CS1503 Argument 1: cannot convert from 'System.Drawing.Bitmap' to 'byte[*,*,*]'
Same
@@hrutikpansare2895 Instala la version Emgu.CV 4.1.1.3497 en lugar de la mas nueva
how i can solve this "cannot convert from 'System.Drawing.Bitmap' to 'byte[*,*,*]'"
Instala la version Emgu.CV 4.1.1.3497 en lugar de la mas nueva
@@ivanestrada2688 Muchas gracias!
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.😁😊
Let me try to research. Thank you for your suggestion !
Yes please. I need tutorial like this
@@foxlearn Hi, have you done the code for this? Thanks in advance
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 ???
OK. Thank you for your suggestion. Let me try to research
CS1503 Argument "1": Converting from "System.Drawing.Bitmap" in "byte[*,*,*]" not Possible
Pls Help
I replace "Image grayImage = new Image(bitmap)" to "var grayImage = bitmap.ToImage();"
it works for me
Perfect! I wish i could like this video 1000 times.
Do you try with a Decklink card & Professional SDI Camera?
At this time no. Thank you !
@@foxlearn What is the song name of the music that starts playing at 8:16? You forgot to mention it in your video description.
Using this face recognition, how do you display the user's information using his face?
why dont you give link "haars_frontface_alt_xtree.xml" files for download? :/
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[*,*,*]'
Please check again. You can see demo code at foxlearn.com
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.
I replace "Image grayImage = new Image(bitmap)" to var "grayImage = bitmap.ToImage();"
it works for me
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)
Please check your code again. I think you miss something
@Alex Caraballo did you solve it??
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 .
Very good tutorial
Thank you very much
You're welcome. Thank you !
everything went perfect but not detecting the face why ??
can you please help me out
great video
is there any video or project for medical face detection using emgu.cv c#?
100% working
I managed to make it work somehow but it is not really detect my face as I have expected.
Thanks for this tutorial yet. so i am waiting the system login and authorization that you have implement on JRE rental software with Devexpress.
I'll write the article on my site. Too much code i can't make the video tutorial
@@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.
@@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.
i got this error: cannot convert from 'System.Drawing.Bitmap' to 'byte[*,*,*]' how could i fix this?
Please check your code again. I think you miss something
i got the same error did u find out what the issue was?
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.
@@lavyksoares9962 Thanks Buddy! :) It helped me solve my issue.
@@lavyksoares9962 Thanks
System.TypeInitializationException: 'The type initializer for 'Face_Detection_Camera.Form1' threw an exception.'
im getting this error hope you can help
Please check your code again. i think you missing something
Very good tutorial
Thank you !
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?
What error are you getting?
@@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.
Have you solved the problem already? It seems I´m having the same issue
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);
I have a problem
"pic.image does not exist in the current context"
What does pic.image mean?
pic is a name of your PictureBox control
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
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.
@@juanottaviano4017 okie dokie
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.
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?
Select an other picture or you can detect your face via webcam
@@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...
Webcam person detection?
Nice tutorial.. Could you please include your pc specs? Thanks
why u need that :D
is object detection included?
face detection
The downgrade emguCv solution is not working, when I installed it it just made the cascadeclassifier not working saying there's no cascadeclassifier
why it doesn't detect my camera? please help
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
You should install the libraries, and don't forget to include to your namespace
Great !
Thank you :)
sorry Sir but I don't Understand what is "cdoDevice"
cboDevice is a name of your Combobox
thanks
Oh WOW!
Thank you !
Amazing.. ..
Thank you !
can i ask you a question
EMGU.CV is open source ?
Yes, It's an opensource
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();
}
}
}
Thank you !
can i use it my own system
Yes, you can
@@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!!!
trainer link: github.com/opencv/opencv/blob/master/data/haarcascades/haarcascade_frontalface_alt_tree.xml
Hi. How to change the server name is PC / SQLEXPRESS to PC. Thanhk you
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[*,*,*]'
I'm also have this error
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
Please upload video on Face emotion detection
خوب
Thank you !
Thank you very much😊, you can find source code here: github.com/MoussaGerges9/Face-Detection.git
Thank you !
Real time detection please
Thank you for your suggestion !
I love you
Not working properly
github link is 404 error
github.com/opencv/opencv/blob/master/data/haarcascades/haarcascade_frontalface_alt_tree.xml in my case I forgot to type twice "opencv"
github.com/opencv/opencv/tree/master/data/haarcascades
Github link
Thank you !
4:05 please ignore this comment
It says cbodevice not found
like.
Thank you !
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
pleas taining c# face compare
OK. Thank you for your suggestion !
Wrong.... not accurate in detection and very slow
redline disapear >
Thank you !
Error CS1503 Argument 1: cannot convert from 'System.Drawing.Bitmap' to 'byte[*,*,*]'
**** Solution ****
Install EmguCV instead of EMGU.CV !!!
**** Solution****
That worked for me!
Do not forget to delete Emgu.CV before or after you install EmguCV!!!!!