C#_ uses EMGUCV 3.0 to operate the local camera
First we want to download emgu3.0, install package, [download Address]http://www.emgu.com/wiki/index.php/download_and_installation
After the installation is complete, according to the platform of the application you want to develop, select the four DLL files in the x86 or x64 copy in the bin directory of the installation directory: Cvextern.dll + msvcp120.dll + msvcr120.dll + opencv_ Ffmpeg310_64.dll/opencv_ffmpeg310.dll to the Bin/debug directory of the application's development directory, add references to all DLL files in the installation directory bin directory, including: Cvextern.dll + Emgu.CV.Contrib.dll + Emgu.CV.Cuda.dll + Emgu.CV.dll + Emgu.CV.ML.dll + Emgu.CV.OCR.dll + Emgu.CV.Shape.dll + Emgu.CV.Stit Ching.dll + Emgu.CV.Superres.dll + Emgu.CV.UI.dll + Emgu.CV.UI.GL.dll + Emgu.CV.VideoStab.dll + Emgu.Util.dll + msvcp120.d ll + msvc120.dll+ Opencv_ffmpeg300_64.dll; it is best to copy all the above files to the debug directory.
After doing the above preparation, we have to do an operation. Add the Imagebox control, which is in the Emgu.CV.UI.dll file and is not provided by the. NET Platform. To add a control, open the Toolbox panel, right-click a blank area of the Toolbox, select Add tab and name Emgu.ui.
Find the Emgu.CV.UI.dll file and drag it into the new tab we just created, and our tab will have a few more controls.
Go to Design view and add Imagebox to the form
Official Add Control Tutorial link (English):< link > Http://www.emgu.com/wiki/index.php/Add_ImageBox_Control
When you finish adding controls, you can start writing code.
Using EMGU.CV;
Using System;
Using System.Windows.Forms; namespace Recognizeface {public partial class Form1:form {public Form1 () {Initial
Izecomponent ();
Private Capture cap;
private bool isprocess = false; void Button1_Click (object sender, EventArgs e) {if (cap!= null) {if
Process) {application.idle-= new EventHandler (Processfram); Button1.
Text = "stop!";
else {application.idle + = new EventHandler (Processfram); Button1.
Text = "start!";
} isprocess =!isprocess;
else {try {cap = new Emgu.CV.Capture (); catch (NullReferenceException expt) {
MessageBox.Show (EXPT.
message); }} private void Processfram (object sender, EventArgs arg) {ImageBox1. Image = Cap.
Queryframe ();
}
}
}
The code is simple, primarily a configuration issue. The code does not elaborate.
Exception: If an exception occurs at run time: the type initializer for "Emgu.CV.CvInvoke" throws an exception. "As far as I know now, it may be because there is no Cvextern.dll + msvcp120.dll + msvcr120.dll + opencv_ffmpeg310_64.dll/opencv_ffmpeg310.dll These four DLL files are added to the debug directory.