1. From http://sourceforge.net/projects/emgucv? Source = directory download the latest emgu
Cv2.4.2;
2. Copy the libemgucv-windows-x86-gpu-2.4.2.1777 to the d: \ soft \ emgu2.4.2folder, run the .exe file, install it to the D: \ soft \ emgu2.4.2 \ emgucv-windows-x86-gpu2.4.2.1777 folder, the installation will automatically restart;
3. d: \ soft \ emgu2.4.2 \ emgucv-windows-x86-gpu2.4.2.1777 \ bin; D: \ soft \ emgu2.4.2 \ emgucv-windows-x86-gpu2.4.2.1777 \ bin \ x86 (the x86 folder contains the corresponding dynamic library opencv2.4.2, after this directory is added to the environment variable, emgu does not need to install the corresponding opencv.) add it to the path of the system environment variable and restart;
4. Open vs2008 and create a new windows form-based application;
5. Import the UI plug-in: tool --> choose toolbox items -->. net
Framework components --> Click Browse and select emgu under D: \ soft \ emgu2.4.2 \ emgucv-windows-x86-gpu2.4.2.1777 \ bin. CV. UI. when the DLL is opened, histogrambox, imagebox, matrixbox, and panandzoompicturebox are added to the list;
6. add reference: Select references under project --> Add reference --> browse select emgu under D: \ soft \ emgu2.4.2 \ emgucv-windows-x86-gpu2.4.2.1777 \ bin. CV. DLL, emgu. CV. ML. DLL,
Emgu. cv. UI. dll, emgu. util. dll, and zedgraph. dll dynamic libraries. Click OK;
7. Click solution platforms --> Configuration Manager: Active solution
Platform changes the original any CPU to x86. Otherwise, the error "emgu. cv. cvinvoke type Initial Value Setting item causes an exception" is displayed.
An online code example is compiled and run successfully:
Usingsystem;
Usingsystem. Collections. Generic;
Usingsystem. componentmodel;
Usingsystem. Data;
Usingsystem. drawing;
Usingsystem. LINQ;
Usingsystem. text;
Usingsystem. Windows. forms;
Usingemgu. CV; // emgu
Usingemgu. cv. structure;
Usingemgu. util;
Usingsystem. Threading;
Namespacetestemgu
{
Public partial
Class form1:
Form
{
Public
Form1 ()
{
Initializecomponent ();
}
Privatecapturecapture;
Privateboolcaptureinprocess; // you can call this operation to determine the camera status.
Privatevoidbutton#click (objectsender,
Eventargse)
{
If (capture! = NULL)
{
If (captureinprocess)
{
Application. Idle-= new
Eventhandler (processframe );
Button1.text = "Stop! ";
}
Else
{
Application. Idle + = new
Eventhandler (processframe );
Button1.text = "start! ";
}
Captureinprocess =! Captureinprocess;
}
Else // if the camera is empty, it is called using the capture () method.
{
Try
{
Capture =
Newcapture ();
}
Catch (nullreferenceexceptionexcpt)
{
MessageBox. Show (excpt. Message );
}
}
}
Privatevoidprocessframe (objectsender,
Eventargsarg)
{
Image <BGR, byte>
Frame = capture. queryframe ();
Imagebox1.image = frame;
}
}
}
References:
1.
Http://www.emgu.com/wiki/
2.
Http://blog.163.com/woshitony111@126/blog/static/71379539201282511180304/
3.
Http://blog.csdn.net/gaaranaruto/article/details/6328358