Setting up Emgu CV and IronPython: Difference between revisions

From EMGU
Jump to navigation Jump to search
No edit summary
Updated ironpython instruction for Emgu CV 2.2 and IronPython 2.7
 
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
* Copy EmguInit.py to the same Folder. The EmguInit.py contains the following code
<source lang="python">
<source lang="python">
import clr
import clr
clr.AddReferenceToFile("Emgu.Util.dll")
clr.AddReferenceToFile("Emgu.CV.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 import *
from Emgu.CV.UI import *
from Emgu.CV.UI import *
from Emgu.CV.Structure import *
from System import *
from System import *
</source>
</source>
Line 27: Line 29:
from EmguInit import *
from EmguInit import *
</source>
</source>
* You are ready to go. The next step you might want to try is the [[Face Detection from IronPython]] example.
 
* 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)