Today I am going to show how can one easily show from webcam in PictureBox control in C#.
First download the EmguCV wrapper from here http://sourceforge.net/projects/emgucv/ then install the EmguCV wrapper.
To use this you need to add some references of EmguCV to your project. To add reference open Solution Explorer and right click on the References.
Then select Add Reference. A new window will open. From there select Browse tab.
From the folder explorer select the required dll and Click OK. Here you will need Emgu.CV.dll & Emgu.Util.dll. You are done with adding reference.
Now add a picturebox and Button to your form.Now Double Click on the Button to add code for the button. Now write the code as follow.
Now Build the project. If everything is okey then no error will occur.
Now its time to run. Now run the project. Though everything was fine it will throw en exception in the time of initialization of capture.
If you see the details you will be able to know that original exception is
“Unable to load DLL ‘opencv_core231’: The specified module could not be found. (Exception from HRESULT: 0x8007007E)”}
That means you have to add this dll or exe s to your debug folder. now add all the exe and dll files from of bin folder of your Emgu installed folder as follow. So that there will be no error in future.
Now run your project and Click on the Button Start. Picture box will show from the webcam live.
Thanks.
Nice blog!! bookmark korlam 😀
Thanks Faisal vhi.
thanks so much, very helpful. good guy!!!
u r most welcome. Share your ideas & problems with us so that we can also learn.
anyway thanks for comments.
Don’t forget you should Dispose() the previous picture since you are the one who created it (with ToBitmap()). 🙂
Thanks.
Hello sir i want to store the capture image in hard disk pls send the code
Very Awesome.
Thanks guys keep share you knowledge
Thanks
some dll and exe are missing in my download
Great Blog fro beginers.
Thanks.
Hiii…..if you getting the error again and again……. and you were added the reference correctly….then remove the references…. and add it again …. this will work for you
thank you 🙂
If you already did the dll setup and still get the exception, try as follows:
Go to Project Properties -> Application -> Target Framework, change it to .NET Framework 4, and presto! Run your application again and it should work just fine.
Hi … If I want to do that in ASP.NET web application what is the control can I use it instead of ImageBox Control and what is changes I must do it on the code ?
Many Thanks