Difference between revisions of "Setting up Emgu CV and IronPython"

From Emgu CV: OpenCV in .NET (C#, VB, C++ and more)
Jump to navigation Jump to search
m
(Updated ironpython instruction for Emgu CV 2.2 and IronPython 2.7)
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
To use [[Emgu CV]] with IronPython, please follow the steps below:
+
To use [[Emgu CV]] 2.2 with IronPython (2.7) on Windows, please follow the steps below:
  
* Download IronPython Binary from its official web page http://www.codeplex.com/IronPython
+
* Download IronPython installable from its official web page http://ironpython.codeplex.com/
  
* Extract the IronPython Binary to a folder
+
* Run IronPython-{version}.msi and follow the instruction to install IronPython
  
* Install [[OpenCV]]
+
* Go to the folder that contains both
** On Windows, copy the required [[OpenCV]] 1.1 dlls to the same Folder, please remember to install MSVCRT 8.0 as well
+
** OpenCV binaries (all the "opencv_{module name}{version}.dll" files)
** On Linux, just install [[OpenCV]] package
+
** Emgu CV binaries (Emgu.CV.dll, Emgu.CV.UI.dll Emgu.Util.dll, ZedGraph.dll)
  
* Copy Emgu.CV.dll, Emgu.Util.dll, ZedGraph.dll and zlib.net.dll to the same Folder
+
* Copy EmguInit.py to the same Folder. The EmguInit.py contains the following code
 
+
<source lang="python">
* Copy Emgu.py to the same Folder
+
import clr
 +
clr.AddReferenceToFile("Emgu.Util.dll")
 +
clr.AddReferenceToFile("Emgu.CV.dll")
 +
clr.AddReferenceToFile("Emgu.CV.ML.dll")
 +
clr.AddReferenceToFile("Emgu.CV.UI.dll")
 +
from Emgu.CV import *
 +
from Emgu.CV.UI import *
 +
from Emgu.CV.Structure import *
 +
from System import *
 +
</source>
  
 
* Run the ipy.exe program. (On Mono, call "mono ipy.exe")  
 
* Run the ipy.exe program. (On Mono, call "mono ipy.exe")  
Line 20: Line 29:
 
from EmguInit import *
 
from EmguInit import *
 
</source>
 
</source>
* You are ready to go.
+
 
 +
* You are ready to go. Now try to run the following simple program
 +
<source lang="python">
 +
image = Image[Gray, Byte](320, 240)
 +
image.SetRandNormal(MCvScalar(100), MCvScalar(100))
 +
ImageViewer.Show(image)
 +
</source>
 +
 
 +
* The next step you might want to try is the [[Face Detection from IronPython]] example.

Latest revision as of 21:04, 28 October 2010

To use Emgu CV 2.2 with IronPython (2.7) on Windows, please follow the steps below:

  • Run IronPython-{version}.msi and follow the instruction to install IronPython
  • Go to the folder that contains both
    • OpenCV binaries (all the "opencv_{module name}{version}.dll" files)
    • Emgu CV binaries (Emgu.CV.dll, Emgu.CV.UI.dll Emgu.Util.dll, ZedGraph.dll)
  • Copy EmguInit.py to the same Folder. The EmguInit.py contains the following code
import clr
clr.AddReferenceToFile("Emgu.Util.dll")
clr.AddReferenceToFile("Emgu.CV.dll")
clr.AddReferenceToFile("Emgu.CV.ML.dll")
clr.AddReferenceToFile("Emgu.CV.UI.dll")
from Emgu.CV import *
from Emgu.CV.UI import *
from Emgu.CV.Structure import *
from System import *
  • Run the ipy.exe program. (On Mono, call "mono ipy.exe")
  • From the IronPython command line, run the following command:
import EmguInit
from EmguInit import *
  • You are ready to go. Now try to run the following simple program
image = Image[Gray, Byte](320, 240)
image.SetRandNormal(MCvScalar(100), MCvScalar(100))
ImageViewer.Show(image)