如何在Android安装JavaCV和使用采集卡 [英] How to install JavaCV on Android and use FrameGrabber
问题描述
有人能告诉我,我做错了什么?这些是我所遵循的步骤:
Could someone tell me where I'm doing wrong? These are the steps that I have followed:
- 下载的ADT-束从窗户Android开发者网站
- 创建一个新的项目和一个库/ armeabi文件夹
-
从javacv-的Android arm.jar提取所有的* .so文件,opencv-2.4.3-android-arm.zip和ffmpeg-1.0-android-arm.zip直接到新创建的库/ armeabi文件夹中,而不会产生任何新的子目录。
- Downloaded the adt-bundle-windows from android developer website
- Created a new project and a libs/armeabi folder
Extract all the *.so files from javacv-android-arm.jar, opencv-2.4.3-android-arm.zip, and ffmpeg-1.0-android-arm.zip directly into the newly created "libs/armeabi" folder, without creating any new subdirectories.
(我不明白的部分是提取所有的*。所以从javacv-的Android arm.jar文件的,我简单地插入了javacv,Android的arm.jar文件内库/ armeabi文件夹)
(A part that I don't understand is "Extract all the *.so files from javacv-android-arm.jar", I simply inserted the javacv-android-arm.jar file inside libs/armeabi folder)
在我从<下载的OpenCV2.4.3 href="http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.4.3/OpenCV-2.4.3.exe/download"相对=nofollow>这里和ffmpeg的距离的>并提取对我的C文件:/根。 最后设置我的系统路径之后...
After that I have downloaded OpenCV2.4.3 from here and ffmpeg from here and extracted the files on my C:/ root. Finally after setting my system path...,
C:\opencv\build\x64\vc10\bin;C:\ffmpeg-64\bin;C:\Program Files\Java\jdk1.7.0_10\bin
...如果我尝试使用简单的采集卡在我的Android应用程序...
...if I try to use simply FrameGrabber in my Android application...
import com.googlecode.javacv.FFmpegFrameGrabber;
import com.googlecode.javacpp.Loader;
import com.googlecode.javacv.*;
import com.googlecode.javacv.cpp.*;
import static com.googlecode.javacv.cpp.opencv_core.*;
import static com.googlecode.javacv.cpp.opencv_imgproc.*;
import static com.googlecode.javacv.cpp.opencv_calib3d.*;
import static com.googlecode.javacv.cpp.opencv_objdetect.*;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FFmpegFrameGrabber i = new FFmpegFrameGrabber("/mnt/sdcard/SinglePerson.avi");
}
...我收到以下错误:
...I get the following errors:
01-29 17:59:26.976: E/AndroidRuntime(30656): FATAL EXCEPTION: main
01-29 17:59:26.976: E/AndroidRuntime(30656): java.lang.NoClassDefFoundError: com.googlecode.javacv.FFmpegFrameGrabber
01-29 17:59:26.976: E/AndroidRuntime(30656): at com.example.xxxxxxxxx.MainActivity.onCreate(MainActivity.java:23)
01-29 17:59:26.976: E/AndroidRuntime(30656): at android.app.Activity.performCreate(Activity.java:4465)
01-29 17:59:26.976: E/AndroidRuntime(30656): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-29 17:59:26.976: E/AndroidRuntime(30656): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
01-29 17:59:26.976: E/AndroidRuntime(30656): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
01-29 17:59:26.976: E/AndroidRuntime(30656): at android.app.ActivityThread.access$600(ActivityThread.java:123)
01-29 17:59:26.976: E/AndroidRuntime(30656): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
01-29 17:59:26.976: E/AndroidRuntime(30656): at android.os.Handler.dispatchMessage(Handler.java:99)
01-29 17:59:26.976: E/AndroidRuntime(30656): at android.os.Looper.loop(Looper.java:137)
01-29 17:59:26.976: E/AndroidRuntime(30656): at android.app.ActivityThread.main(ActivityThread.java:4424)
01-29 17:59:26.976: E/AndroidRuntime(30656): at java.lang.reflect.Method.invokeNative(Native Method)
01-29 17:59:26.976: E/AndroidRuntime(30656): at java.lang.reflect.Method.invoke(Method.java:511)
01-29 17:59:26.976: E/AndroidRuntime(30656): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-29 17:59:26.976: E/AndroidRuntime(30656): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-29 17:59:26.976: E/AndroidRuntime(30656): at dalvik.system.NativeStart.main(Native Method)
有人能帮助我吗?
Someone can help me please?
推荐答案
因此,一个jar文件基本上是一个压缩文件,如果您更改扩展名改为.zip,你可以提取它包含了像你这样跟OpenCV的文件和FFMPEG。
So a jar file is basically a zip file, if you change the extension to ".zip" you can extract the files it contains like you did with OpenCV and FFMPEG.
所以,重命名javacv,Android的arm.jar到javacv-android-arm.zip,提取.so文件了出来,并把它们复制到库/ armeabi。
So, rename "javacv-android-arm.jar" to " javacv-android-arm.zip," extract the .so files out of it and copy them to libs/armeabi.
祝你好运!
这篇关于如何在Android安装JavaCV和使用采集卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!