2010年8月26日木曜日

Using Emgu CV on Mac OSX


Yesterday, I thought of trying to run Emgu CV on Mac OSX.
I write what I did for that here.

*Emgu CV is a OSS Open CV wrapper for .Net framework.

OS: Mac OSX Snow Leopard (10.6.4) failed
Mac OSX Leopard(10.5.8) succeed!

1. Installing Mono and Monodevelop (for now you dont really need Monodevelop)

== Japanese problem ==
You need to specify a font that can be used for your own language if you are using Multi-bytes.
Create next file with admin authority.
/Library/Frameworks/Mono.Framework/Version/Current/etc/pango/pango.aliases
Write a line like below.
"Lucida Grande" = "Hiragino Kaku Gothic Pro"
==================

2. Installing depending libraries via Macports
sudo port selfupdate
sudo port upgrade outdated
sudo port install cmake
sudo port install ffmpeg
sudo port install tiff
3. Get a source code from SVN repository
svn co https://emgucv.svn.sourceforge.net/svnroot/emgucv/trunk emgucv
4. Creating make file by cmake
cmake -DBUILD_NEW_PYTHON_SUPPORT:BOOL=FALSE -DBUILD_TESTS:BOOL=FALSE .

5. Executing make
make
6. Running samples
move to bin directory
set value to read library from current directory

export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
execute a sample
mono Example.PlanarSubdivision.monoexe
Error!
System.DllNotFoundException
7. Setting Log level and execute again
MONO_LOG_LEVEL=debug mono Example.PlanarSubdivision.monoexe
It seems 64bit is not supported by Mono 2.6.7 so that it is hard to run on Snow Leopard.

8. Trying to build with 32bit option
cmake -DCMAKE_OSX_ARCHITECTURES=i386 -DBUILD_NEW_PYTHON_SUPPORT:BOOL=FALSE -DBUILD_TESTS:BOOL=FALSE .
got an error at make command.
It said something like Open CV should be 64bit...

hmm, I gave up with Snow Leopard ...

9. Trying with Leopard (10.5.8)
Mostly same as above however library path was different so set as below.
export LD_LIBRARY_PATH=../lib:.:$LD_LIBRARY_PATH
I could run the sample!