首先确定没有重复安装opencv和emgucv两种,这样有可能在配置path时会出错。emgucv是包含opencv的,使用C#开发的朋友们,可以放心的只安装emgucv。
1、如遇错误提示:tbb_debug.dll找不到
2、如遇错误提示:“Emgu.CV.CvInvoke”的类型初始值设定项引发异常
官方解决办法:
(1)安装时注意:
ou can run an
Getting the Dependency
- Emgu CV
use WCF(Windows Communication Foundation) therefore requires .Net 3.0 - For version 2.4+ the bundled OpenCV binary is build with Visual Studio 2010, you will needs to installed
MSVCRT 9.0 SP1 x86 or MSVCRT 9.0 SP1 x64to resolve the dependency issue. - For Version 2.0+, the bundled OpenCV binary is build with Visual Studio 2008, you will needs to installed
MSVCRT 9.0 SP1 to resolve the dependency issue. - For Version 1.5, the bundled OpenCV pre1.1 binary is build with Visual Studio 2005, you will needs to installed
MSVCRT 8.0 SP1 to resolve the dependency issue.
Building the Examples
- Follow
this link to the file server on Source Forge. - Download and extract the windows installer.
- Install the software
- Go to the Solution folder
- If you are using Visual Studio 2008, browse to VS2008
- If you are using Visual Studio 2010, browse to VS2010
- Open
Emgu.CV.Example.sln
and build the solution. At this point, you should be able to run the example programs.
Creating a New Project in Visual Studio
To use the framework in Visual Studio, you need to
- Download and extract the binary files package
Emgu.CV.Windows.Binary-{version}.zip
For a Full guide to using the dependencies under Visual Studio and C# see the
Core Functionality
Managed Code
- Create a new Visual Studio project or use an existing one
- Add the two files
Emgu.Utils.dll
and Emgu.CV.dll
to References of the project. as well. - Optionally put the following lines in the top of your code to include the Emgu.CV namespace.
using Emgu.CV; using Emgu.CV.Structure;
Open CV unmanaged dll
Copy the opencv_calib3d{XXX}.dll
, opencv_contrib{XXX}.dll
, opencv_core{XXX}.dll
, opencv_features2d{XXX}.dll
, opencv_ffmpeg{XXX}.dll
,opencv_flann{XXX}.dll
, opencv_gpu{XXX}.dll
, opencv_highgui{XXX}.dll
, opencv_imgproc{XXX}.dll
, opencv_legacy{XXX}.dll
, opencv_ml{XXX}.dll
,opencv_objdetect{XXX}.dll
, opencv_video{XXX}.dll
cvextern.dll
{XXX}
(2)The type initializer for 'Emgu.CV.CvInvoke' threw an exception.(Emgu.CV.CvInvoke 的类型初始值设定项引发异常)
If you see this exception, please check the following
Have you installed MSVCRT?
- For Version 2.4+, the bundled OpenCV binary is build with Visual Studio 2010, you will needs to installed
MSVCRT 10.0 SP1 x86 or MSVCRT 10.0 SP1 x64 to resolve the dependency issue. - For Version 2.0+, the bundled OpenCV binary is build with Visual Studio 2008, you will needs to installed
MSVCRT 9.0 SP1 to resolve the dependency issue. - For Version 1.5, the bundled OpenCV pre1.1 binary is build with Visual Studio 2005, you will needs to installed
MSVCRT 8.0 SP1 to resolve the dependency issue.
Have you copied the OpenCV dlls to the execution directory?
- Make sure the unmanaged DLLs are in the execution directory.
- For Emgu CV version <= 2.1, this means the following dlls:
cvXXX.dll, cvauxXXX.dll, cxcoreXXX.dll, highguiXXX.dll, opencv_ffmpegXXX.dll, mlXXX.dllcvextern.dll
where XXX
is the OpenCV version number. - For Emgu CV version 2.2, 2.3 this means the following dlls:
opencv_calib3dXXX.dll, opencv_contribXXX.dll, opencv_coreXXX.dll, opencv_features2dXXX.dll, opencv_highguiXXX.dll, opencv_imgprocXXX.dll, opencv_legacyXXX.dll, opencv_mlXXX.dll, opencv_objectdetectXXX.dll, opencv_videoXXX.dll
where XXX
is the OpenCV version number. - For EMGU CV version >=2.4
cudart64_42_9.dll, cvextern.dll, npp64_42_9.dll, opencv_calib3dXXX.dll, opencv_contribXXX.dll, opencv_coreXXX.dll, opencv_features2dXXX.dll, opencv_flannXXX.dll, opencv_highguiXXX.dll, opencv_imgprocXXX.dll, opencv_legacyXXX.dll, opencv_mlXXX.dll, opencv_nonfreXXX.dll, opencv_objectdetectXXX.dll, opencv_videoXXX.dll,
where XXX
is the OpenCV version number.
- For Emgu CV version <= 2.1, this means the following dlls:
- The best way to set up your project is:
- Copy the unmanaged DLLs to your project folder
- Right click on the project, click Add->Existing Item and select all unmanaged DLLs. Add them to the project.
- For each of the included Dlls, left click on it, find the "Copy to Output Directory" option and select "Copy if newer"
注意X86和 64位应该是有不同的,64不行,就试下32位的绝对就可以了