Compiling OpenCV JavaCPP JavaCV for Raspberry Pi

Reference to Salaboy's great tutorial
http://salaboy.com/2013/06/14/using-javacv-in-the-raspberry-pi-linux-arm/

Hardware requirements
A Raspberry Pi <<revision memory picture>>
A 16 GB 20Mb/s SD card was purchased and used for the build after spending a day+ waiting for a compile to run on a usb drive.

Operating System
wheezy - hard point (link)

pi@raspberrypi ~/build/javacv/javacpp $ uname -a
Linux raspberrypi 3.6.11+ #538 PREEMPT Fri Aug 30 20:42:08 BST 2013 armv6l GNU/Linux

Build essentials - apt-get install (all necessary) - maven

 

OpenCV

cd ~
mkdir build
cb build
mkdir opencv
cd opencv
wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.6.1/opencv-2.4.6.1.tar.gz
tar zxvf opencv-2.4.6.1.tar.gz
cd opencv-2.4.6.1/
mkdir release
cd release

$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=OFF -D BUILD_EXAMPLES=ON -D WITH_GTK=ON -D WITH_UNICAP=ON -D WITH_V4L=ON ..

References

JavaCV

JavaCV really consists of 2 projects JavaCV and JavaCPP.  

directory structure

./build
./build/opencv
./build/javacv
./build/javacv/javacv
./build/javacv/javapp

JavaCPP

The build options for JavaCPP need to change.  Current build options cater to arm processors in smartphones, and to the most common settings

http://www.raspberrypi.org/phpBB3/viewtopic.php?f=66&t=11629

vi /home/pi/build/javacv/javacpp/src/main/resources/com/googlecode/javacpp/properties/android-arm.properties

I changed the following configuration properties to force Raspberry Pi's suggested compiling settings

compiler.options.default=-march=armv6zk -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard
compiler.options.fastfpu=-march=armv6zk -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard
 

cd ~/build/javacv/javacpp
mvn clean install -Dplatform.name=linux-arm

JavaCV

cd ~/build/javacv/javacv
mvn clean install -Dplatform.name=linux-arm

References

References to other builds

 


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Alessandruino's picture

Grog...you changed

Grog...you changed the android-arm.properties but you compiled for linux-arm mvn clean install -Dplatform.name=linux-arm 

:( so maybe you need to change the linux-arm.properties instead :(

Alessandruino's picture

I tried following salaboy

I tried following salaboy instructions...

JavaCPP is sucessfully compiled..

JavaCV gives me this error :

 
/home/pi/build/javacv/javacv/target/classes/com/googlecode/javacv/cpp/jnicvkernels.cpp:28:17: fatal err          or: jni.h: No such file or directory
compilation terminated.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:45.461s
[INFO] Finished at: Mon Dec 09 12:32:14 UTC 2013
[INFO] Final Memory: 11M/57M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:exec (javacpp) on project javacv          : Command execution failed. Process exited with an error: 1(Exit value: 1) -> [Help 1]
 
 
detailed log :
 
   at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:104)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
 

 

GroG's picture

soft or hard baked ?

When building javacv this is what I'm getting for the output ..

We want mfloat-abi=hard for hard floating point support