In September 2014, I documented how to compile EmguCV on the Raspberry Pi. At the time I didn't even know if it would work and so hacked away removing code and compile errors until it finally compiled.
My old Pi died before Christmas and the model B replacement needed a new compile of EmguCV. Here is how I did it this time, in a more refined manner.
This time I compiled mono 3.12.0 from a tarball download. The sudo apt-get upgrade method for Debian didn't work on the pi with 'you have held broken packages' errors. I added an export to ~/.profile to make the path to the mono bin folder persist through reboots.
Update April 2015: See these newer instructions
This time I used EmguCV master from commit 0a47c32492c336cedecdc191459956f67ad64edc from January 15 2015.
As before, this is documenting deviations from the Ubuntu 14.04 compile instructions.
The first deviation is to cmake in which we turn a few extra things off in the compile.
cmake -DBUILD_TESTS:BOOL=FALSE -DBUILD_DOCS:BOOL=FALSE -DEMGU_CV_WITH_TIFF:BOOL=FALSE -DWITH_TBB:BOOL=FALSE -DWITH_CUDA:BOOL=FALSE -DWITH_OPENCL:BOOL=FALSE -DWITH_IPP:BOOL=FALSE -DWITH_EIGEN:BOOL=FALSE -DEMGU_CV_WITH_TESSERACT:BOOL=FALSE -DBUILD_PERF_TESTS:BOOL=FALSE
After cmake is configured, make is executed and after some time this error happened:
In file included from /home/pi/emgucv/Emgu.CV.Extern/vector_ERStat.cpp:10:0: /home/pi/emgucv/Emgu.CV.Extern/vector_ERStat.h:17:37: fatal error: opencv2/text/erfilter.hpp: No such file or directory compilation terminated. Emgu.CV.Extern/CMakeFiles/cvextern.dir/build.make:701: recipe for target 'Emgu.CV.Extern/CMakeFiles/cvextern.dir/vector_ERStat.cpp.o' failed make: *** [Emgu.CV.Extern/CMakeFiles/cvextern.dir/vector_ERStat.cpp.o] Error 1 CMakeFiles/Makefile2:4468: recipe for target 'Emgu.CV.Extern/CMakeFiles/cvextern.dir/all' failed make: *** [Emgu.CV.Extern/CMakeFiles/cvextern.dir/all] Error 2 Makefile:146: recipe for target 'all' failed make: *** [all] Error 2
The fix was
mkdir -p ./Emgu.CV.Extern/opencv2/text cp ./opencv_contrib/modules/text/include/opencv2/text/erfilter.hpp ./Emgu.CV.Extern/opencv2/text
After that, there was only one more error.
Linking CXX shared library ../bin/libcvextern.so [100%] Built target cvextern Linking CXX executable ../../bin/cvextern_test ../../bin/libcvextern.so: undefined reference to `cv::text::ERStat::ERStat(int, int, int, int)' collect2: ld returned 1 exit status tests/cvextern_test/CMakeFiles/cvextern_test.dir/build.make:115: recipe for target 'bin/cvextern_test' failed make: *** [bin/cvextern_test] Error 1 CMakeFiles/Makefile2:3288: recipe for target 'tests/cvextern_test/CMakeFiles/cvextern_test.dir/all' failed make: *** [tests/cvextern_test/CMakeFiles/cvextern_test.dir/all] Error 2 Makefile:146: recipe for target 'all' failed make: *** [all] Error 2
Interestingly this is ERStat again. This time I removed these lines from the root CMakeLists.txt
IF(NOT (ANDROID OR IOS)) ENABLE_TESTING() ADD_SUBDIRECTORY(tests/cvextern_test) ENDIF()
Run cmake and then make and EmguCV compiles successfully.