JavaCV & Android

JavaCV-0.5基於OpenCV-2.4.5,在Android上運行按照教程設置即可,有幾個注意事項:

教程:[url]https://code.google.com/p/javacv/[/url]
Eclipse (Android 2.2 or newer):

1.Follow the instructions on this page: http://developer.android.com/training/basics/firstapp/
2.Go to File > New > Folder, select your project as parent folder, type "libs/armeabi" as Folder name, and click Finish.
3.Copy javacpp.jar and javacv.jar into the newly created "libs" folder.
4.Extract all the *.so files from javacv-android-arm.jar, opencv-2.4.5-android-arm.jar, and ffmpeg-1.2-android-arm.jar directly into the newly created "libs/armeabi" folder, without creating any of the subdirectories found in the JAR files.
5.Navigate to Project > Properties > Java Build Path > Libraries and click "Add JARs...".
6.Select both javacpp.jar and javacv.jar from the newly created "libs" folder.


注意事項:
1.上面第三步和第四步是分別複製到libs和libs/armeabi目錄
2.該庫運行需要CPU支持FPU(要在不支持FPU的機器上運行,需要自己修改參數重新編譯庫,運行效果可能很差)
查看CPU是否支持FPU方法:[url]http://stackoverflow.com/questions/8161184/detecting-fpu-presence-on-android[/url]

# cat /proc/cpuinfo
Processor : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 249.96
Features : swp half thumb fastmult vfp edsp neon vfpv3
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x1
CPU part : 0xc08
CPU revision : 3
[ ... ]
If the "Features" line lists at least vfp, then the ARM SoC has an FPU.

3.模擬器不支持攝像頭
4.如果沒有後置攝像頭,需要修改示例代碼
FacePreview.java中
mCamera = Camera.open(); 改爲 mCamera = Camera.open(0);
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章