OpenCV4Android 不需要安装OpenCVManager,就可以运行的方法
http://blog.csdn.net/yanzi1225627/article/details/27863615
OpenCV4Android释疑: 透析Android以JNI调OpenCV的三种方式(让OpenCVManager永不困扰)
根据上文中的方法。使用OpenCV3.0.0
Android.mk文件为:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS) OpenCV_INSTALL_MODULES:=on
OPENCV_CAMERA_MODULES:=off OPENCV_LIB_TYPE:=STATIC //静态没有成功,改为SHARED可以 ifeq ("$(wildcard $(OPENCV_MK_PATH))","")
include /home/myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/OpenCV.mk //为了编译依赖OpenCV的so
else
include $(OPENCV_MK_PATH)
endif LOCAL_MODULE := TestOpenCV //生成so的名
LOCAL_SRC_FILES := jni_part.cpp //jni下的cpp文件名
LOCAL_LDLIBS += -lm -llog include $(BUILD_SHARED_LIBRARY)
出现以下几种形式的错误
(1)OPENCV_LIB_TYPE:=STATIC 报了以下一堆错误
:~/workspace/TestOpenCV$ ndk-build
Compile++ thumb : TestOpenCV <= jni_part.cpp
SharedLibrary : libTestOpenCV.so
Install : libTestOpenCV.so => libs/armeabi-v7a/libTestOpenCV.so
lenovo-myc@lenovomyc-Lenovo-Product:~/workspace/TestOpenCV$ ndk-build
Install : libTestOpenCV.so => libs/armeabi-v7a/libTestOpenCV.so
lenovo-myc@lenovomyc-Lenovo-Product:~/workspace/TestOpenCV$ ndk-build
Install : libTestOpenCV.so => libs/armeabi-v7a/libTestOpenCV.so
lenovo-myc@lenovomyc-Lenovo-Product:~/workspace/TestOpenCV$ ndk-build
Compile++ thumb : TestOpenCV <= jni_part.cpp
Prebuilt : libgnustl_static.a <= <NDK>/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/
SharedLibrary : libTestOpenCV.so
Install : libTestOpenCV.so => libs/armeabi-v7a/libTestOpenCV.so
lenovo-myc@lenovomyc-Lenovo-Product:~/workspace/TestOpenCV$ ndk-build
Compile++ thumb : TestOpenCV <= jni_part.cpp
Prebuilt : libopencv_shape.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/
Prebuilt : libopencv_stitching.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/
Prebuilt : libopencv_objdetect.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/
Prebuilt : libopencv_superres.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/
Prebuilt : libopencv_ts.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/
Prebuilt : libopencv_videostab.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/
Prebuilt : libopencv_calib3d.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/
Prebuilt : libopencv_features2d.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/
Prebuilt : libopencv_highgui.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/
Prebuilt : libopencv_videoio.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/
Prebuilt : libopencv_imgcodecs.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/
Prebuilt : libopencv_androidcamera.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/
Prebuilt : libopencv_video.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/
Prebuilt : libopencv_photo.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/
Prebuilt : libopencv_ml.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/
Prebuilt : libopencv_imgproc.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/
Prebuilt : libopencv_flann.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/
Prebuilt : libopencv_core.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/
Prebuilt : libopencv_hal.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../libs/armeabi-v7a/
Prebuilt : liblibjpeg.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/
Prebuilt : liblibwebp.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/
Prebuilt : liblibpng.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/
Prebuilt : liblibtiff.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/
Prebuilt : liblibjasper.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/
Prebuilt : libIlmImf.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/
Prebuilt : libtbb.a <= /home/lenovo-myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi-v7a/
SharedLibrary : libTestOpenCV.so
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_features2d.a(fast.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_features2d.a(fast_score.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_features2d.a(feature2d.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_features2d.a(keypoint.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_features2d.a(opencl_kernels_features2d.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_imgproc.a(color.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_imgproc.a(demosaicing.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_imgproc.a(drawing.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_imgproc.a(hershey_fonts.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_imgproc.a(tables.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(algorithm.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(alloc.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(convert.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(copy.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(datastructs.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(mathfuncs.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(matrix.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(ocl.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(opengl.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(parallel.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(persistence.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(stat.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(stl.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(system.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(umatrix.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(arithm.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(array.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(cuda_gpu_mat.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(cuda_host_mem.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(cuda_stream.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(kmeans.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(lapack.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(matmul.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(matop.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(pca.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(rand.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_core.a(tables.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_hal.a(mathfuncs.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_hal.a(matrix.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libopencv_hal.a(stat.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libtbb.a(governor.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libtbb.a(market.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libtbb.a(private_server.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libtbb.a(scheduler.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libtbb.a(task.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libtbb.a(task_group_context.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libtbb.a(tbb_main.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libtbb.a(tbb_misc.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libtbb.a(rml_tbb.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libtbb.a(arena.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libtbb.a(cache_aligned_allocator.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libtbb.a(dynamic_link.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libtbb.a(observer_proxy.cpp.o): Unknown EABI object attribute
/home/lenovo-myc/android_developer_tools/android-ndk-r8/toolchains/arm-linux-androideabi-4.4./prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4./../../../../arm-linux-androideabi/bin/ld: Warning: ./obj/local/armeabi-v7a/libtbb.a(spin_rw_mutex.cpp.o): Unknown EABI object attribute
./obj/local/armeabi-v7a/libopencv_core.a(ocl.cpp.o): In function `cv::ocl::Kernel::set(int, cv::ocl::Image2D const&)':
ocl.cpp:(.text._ZN2cv3ocl6Kernel3setEiRKNS0_7Image2DE+0x28): undefined reference to `std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)'
./obj/local/armeabi-v7a/libopencv_core.a(ocl.cpp.o): In function `cv::ocl::OpenCLBufferPoolBaseImpl<cv::ocl::OpenCLBufferPoolImpl, cv::ocl::CLBufferEntry, _cl_mem*>::_checkSizeOfReservedEntries()':
ocl.cpp:(.text._ZN2cv3ocl24OpenCLBufferPoolBaseImplINS0_20OpenCLBufferPoolImplENS0_13CLBufferEntryEP7_cl_memE27_checkSizeOfReservedEntriesEv[cv::ocl::OpenCLBufferPoolBaseImpl<cv::ocl::OpenCLBufferPoolImpl, cv::ocl::CLBufferEntry, _cl_mem*>::_checkSizeOfReservedEntries()]+0x22): undefined reference to `std::__detail::_List_node_base::_M_unhook()'
./obj/local/armeabi-v7a/libopencv_core.a(ocl.cpp.o): In function `cv::ocl::OpenCLBufferPoolBaseImpl<cv::ocl::OpenCLBufferPoolImpl, cv::ocl::CLBufferEntry, _cl_mem*>::setMaxReservedSize(unsigned int)':
ocl.cpp:(.text._ZN2cv3ocl24OpenCLBufferPoolBaseImplINS0_20OpenCLBufferPoolImplENS0_13CLBufferEntryEP7_cl_memE18setMaxReservedSizeEj[cv::ocl::OpenCLBufferPoolBaseImpl<cv::ocl::OpenCLBufferPoolImpl, cv::ocl::CLBufferEntry, _cl_mem*>::setMaxReservedSize(unsigned int)]+0x46): undefined reference to `std::__detail::_List_node_base::_M_unhook()'
./obj/local/armeabi-v7a/libopencv_core.a(ocl.cpp.o): In function `cv::ocl::OpenCLBufferPoolBaseImpl<cv::ocl::OpenCLBufferPoolImpl, cv::ocl::CLBufferEntry, _cl_mem*>::release(_cl_mem*)':
ocl.cpp:(.text._ZN2cv3ocl24OpenCLBufferPoolBaseImplINS0_20OpenCLBufferPoolImplENS0_13CLBufferEntryEP7_cl_memE7releaseES5_[cv::ocl::OpenCLBufferPoolBaseImpl<cv::ocl::OpenCLBufferPoolImpl, cv::ocl::CLBufferEntry, _cl_mem*>::release(_cl_mem*)]+0x40): undefined reference to `std::__detail::_List_node_base::_M_unhook()'
ocl.cpp:(.text._ZN2cv3ocl24OpenCLBufferPoolBaseImplINS0_20OpenCLBufferPoolImplENS0_13CLBufferEntryEP7_cl_memE7releaseES5_[cv::ocl::OpenCLBufferPoolBaseImpl<cv::ocl::OpenCLBufferPoolImpl, cv::ocl::CLBufferEntry, _cl_mem*>::release(_cl_mem*)]+0xe4): undefined reference to `std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)'
./obj/local/armeabi-v7a/libopencv_core.a(ocl.cpp.o): In function `cv::ocl::OpenCLBufferPoolBaseImpl<cv::ocl::OpenCLBufferPoolImpl, cv::ocl::CLBufferEntry, _cl_mem*>::_findAndRemoveEntryFromReservedList(cv::ocl::CLBufferEntry&, unsigned int)':
ocl.cpp:(.text._ZN2cv3ocl24OpenCLBufferPoolBaseImplINS0_20OpenCLBufferPoolImplENS0_13CLBufferEntryEP7_cl_memE35_findAndRemoveEntryFromReservedListERS3_j[cv::ocl::OpenCLBufferPoolBaseImpl<cv::ocl::OpenCLBufferPoolImpl, cv::ocl::CLBufferEntry, _cl_mem*>::_findAndRemoveEntryFromReservedList(cv::ocl::CLBufferEntry&, unsigned int)]+0x54): undefined reference to `std::__detail::_List_node_base::_M_unhook()'
ocl.cpp:(.text._ZN2cv3ocl24OpenCLBufferPoolBaseImplINS0_20OpenCLBufferPoolImplENS0_13CLBufferEntryEP7_cl_memE35_findAndRemoveEntryFromReservedListERS3_j[cv::ocl::OpenCLBufferPoolBaseImpl<cv::ocl::OpenCLBufferPoolImpl, cv::ocl::CLBufferEntry, _cl_mem*>::_findAndRemoveEntryFromReservedList(cv::ocl::CLBufferEntry&, unsigned int)]+0x8e): undefined reference to `std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)'
./obj/local/armeabi-v7a/libopencv_core.a(ocl.cpp.o): In function `cv::ocl::OpenCLBufferPoolImpl::_allocateBufferEntry(cv::ocl::CLBufferEntry&, unsigned int)':
ocl.cpp:(.text._ZN2cv3ocl20OpenCLBufferPoolImpl20_allocateBufferEntryERNS0_13CLBufferEntryEj[cv::ocl::OpenCLBufferPoolImpl::_allocateBufferEntry(cv::ocl::CLBufferEntry&, unsigned int)]+0x8a): undefined reference to `std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)'
collect2: ld returned exit status
make: *** [obj/local/armeabi-v7a/libTestOpenCV.so] Error
ndk-build错误
没解决
(2)改为 OPENCV_LIB_TYPE:=SHARED之后。编译通过。工程下生成 libs 和 obj目录下的文件
(3)修改Activity文件如下:
package com.example.testopencv; import org.opencv.android.BaseLoaderCallback;
import org.opencv.android.LoaderCallbackInterface;
import org.opencv.android.OpenCVLoader;
import org.opencv.android.Utils;
import org.opencv.core.Mat;
import org.opencv.imgproc.Imgproc; import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView; /**
* 图像灰度化demo
*
* @author myc
*
*/
public class NoManagerOpenCVActivity extends Activity{
Button btnProcess;
Bitmap srcBitmap;
Bitmap grayBitmap;
ImageView imgHuaishi;
private static boolean flag = true;
private boolean isFirst = true;
private static final String TAG = "NoManagerActivity"; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_main); initUI();
btnProcess.setOnClickListener(new ProcessClickListener());
} // OpenCV库加载并初始化成功后的回调函数
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { @Override
public void onManagerConnected(int status) {
// TODO Auto-generated method stub
switch (status) {
case BaseLoaderCallback.SUCCESS:
Log.i(TAG, "成功加载");
break;
default:
super.onManagerConnected(status);
Log.i(TAG, "加载失败");
break;
} }
}; public void initUI() {
btnProcess = (Button) findViewById(R.id.btn_gray_process);
imgHuaishi = (ImageView) findViewById(R.id.img_huaishi);
Log.i(TAG, "initUI sucess..."); } public void procSrc2Gray() {
Mat rgbMat = new Mat();
Mat grayMat = new Mat();
srcBitmap = BitmapFactory.decodeResource(getResources(),
R.drawable.nanhuaijin);
grayBitmap = Bitmap.createBitmap(srcBitmap.getWidth(),
srcBitmap.getHeight(), Config.RGB_565);
Utils.bitmapToMat(srcBitmap, rgbMat);// convert original bitmap to Mat,
// R G B.
Imgproc.cvtColor(rgbMat, grayMat, Imgproc.COLOR_RGB2GRAY);// rgbMat to
// gray
// grayMat
Utils.matToBitmap(grayMat, grayBitmap); // convert mat to bitmap
Log.i(TAG, "procSrc2Gray sucess...");
} private class ProcessClickListener implements OnClickListener { @Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (isFirst) {
procSrc2Gray();
isFirst = false;
}
if (flag) {
imgHuaishi.setImageBitmap(grayBitmap);
btnProcess.setText("查看原图");
flag = false;
} else {
imgHuaishi.setImageBitmap(srcBitmap);
btnProcess.setText("灰度化");
flag = true;
}
} } @Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume(); }
public native void FindFeatures(long matAddrGr, long matAddrRgba);
}
将OpenCVLoader.initAsync 这句注释掉,因为这句是使用OpenCVManager的。
修改为加载刚生成的库 System.loadLibrary("TestOpenCV");
(4)需要将 /home/myc/Documents/sdk/openCV/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/opencv_java.so 拷到libs路径下
(和LibTestOpenCV.so一起)。如果没有拷过来,会报如下错误:
- ::47.956: I/NoManagerActivity(): initUI sucess...
- ::47.956: I/NoManagerActivity(): OpenCV library load!
- ::47.956: D/OpenCV/StaticHelper(): Trying to get library list
- ::47.966: E/OpenCV/StaticHelper(): OpenCV error: Cannot load info library for OpenCV
- ::47.966: D/OpenCV/StaticHelper(): Library list: ""
- ::47.966: D/OpenCV/StaticHelper(): First attempt to load libs
- ::47.966: D/OpenCV/StaticHelper(): Trying to init OpenCV libs
- ::47.966: D/OpenCV/StaticHelper(): Trying to load library opencv_java
- ::47.966: D/OpenCV/StaticHelper(): Cannot load library "opencv_java"
- ::47.966: W/System.err(): java.lang.UnsatisfiedLinkError: Couldn't load opencv_java from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.testopencv-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.testopencv-1, /vendor/lib, /system/lib]]]: findLibrary returned null
- ::47.966: W/System.err(): at java.lang.Runtime.loadLibrary(Runtime.java:)
- ::47.966: W/System.err(): at java.lang.System.loadLibrary(System.java:)
- ::47.966: W/System.err(): at org.opencv.android.StaticHelper.loadLibrary(StaticHelper.java:)
- ::47.966: W/System.err(): at org.opencv.android.StaticHelper.initOpenCVLibs(StaticHelper.java:)
- ::47.966: W/System.err(): at org.opencv.android.StaticHelper.initOpenCV(StaticHelper.java:)
- ::47.966: W/System.err(): at org.opencv.android.OpenCVLoader.initDebug(OpenCVLoader.java:)
- ::47.966: W/System.err(): at com.example.testopencv.NoManagerActivity.onResume(NoManagerActivity.java:)
- ::47.966: W/System.err(): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:)
- ::47.966: W/System.err(): at android.app.Activity.performResume(Activity.java:)
- ::47.966: W/System.err(): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:)
- ::47.966: W/System.err(): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:)
- ::47.966: W/System.err(): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:)
- ::47.966: W/System.err(): at android.app.ActivityThread.access$(ActivityThread.java:)
- ::47.966: W/System.err(): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:)
- ::47.966: W/System.err(): at android.os.Handler.dispatchMessage(Handler.java:)
- ::47.966: W/System.err(): at android.os.Looper.loop(Looper.java:)
- ::47.966: W/System.err(): at android.app.ActivityThread.main(ActivityThread.java:)
- ::47.966: W/System.err(): at java.lang.reflect.Method.invokeNative(Native Method)
- ::47.966: W/System.err(): at java.lang.reflect.Method.invoke(Method.java:)
- ::47.966: W/System.err(): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:)
- ::47.966: W/System.err(): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:)
- ::47.966: W/System.err(): at dalvik.system.NativeStart.main(Native Method)
- ::47.966: D/OpenCV/StaticHelper(): First attempt to load libs fails
- ::47.966: I/NoManagerActivity(): OpenCV load not successfully
缺少Libopencv_java.so报错
注:在OpenCV Library - 3.0.0-rc1 工程的 StaticHelper.java 中有如下代码:
// If dependencies list is not defined or empty.
result &= loadLibrary("opencv_java");
即在OpenCVLoader初始化过程中,dependencies list 未定义或者为空的情况下,都会默认加载Libopencv_java.so
因此即使Activity中 System.loadLibrary("opencv_java"); 这句被注释掉,还是会报错。
(5)下边这个错调了半天,发现将 System.loadLibrary("TestOpenCV");写成了 System.loadLibrary("LibTestOpenCV");
应该和 LOCAL_MODULE := TestOpenCV 一致
- ::56.206: I/NoManagerActivity(): initUI sucess...
- ::56.206: I/NoManagerActivity(): OpenCV library load!
- ::56.206: D/dalvikvm(): Trying to load lib /data/app-lib/com.example.testopencv-/libopencv_java.so 0x41f4ae80
- ::56.236: D/dalvikvm(): Added shared lib /data/app-lib/com.example.testopencv-/libopencv_java.so 0x41f4ae80
- ::56.236: I/NoManagerActivity(): start loading libTestOpenCV
- ::56.236: D/AndroidRuntime(): Shutting down VM
- ::56.236: W/dalvikvm(): threadid=: thread exiting with uncaught exception (group=0x415a9898)
- ::56.236: E/AndroidRuntime(): FATAL EXCEPTION: main
- ::56.236: E/AndroidRuntime(): java.lang.UnsatisfiedLinkError: Couldn't load libTestOpenCV from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.testopencv-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.testopencv-1, /vendor/lib, /system/lib]]]: findLibrary returned null
- ::56.236: E/AndroidRuntime(): at java.lang.Runtime.loadLibrary(Runtime.java:)
- ::56.236: E/AndroidRuntime(): at java.lang.System.loadLibrary(System.java:)
- ::56.236: E/AndroidRuntime(): at com.example.testopencv.NoManagerActivity.onResume(NoManagerActivity.java:)
- ::56.236: E/AndroidRuntime(): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:)
- ::56.236: E/AndroidRuntime(): at android.app.Activity.performResume(Activity.java:)
- ::56.236: E/AndroidRuntime(): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:)
- ::56.236: E/AndroidRuntime(): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:)
- ::56.236: E/AndroidRuntime(): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:)
- ::56.236: E/AndroidRuntime(): at android.app.ActivityThread.access$(ActivityThread.java:)
- ::56.236: E/AndroidRuntime(): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:)
- ::56.236: E/AndroidRuntime(): at android.os.Handler.dispatchMessage(Handler.java:)
- ::56.236: E/AndroidRuntime(): at android.os.Looper.loop(Looper.java:)
- ::56.236: E/AndroidRuntime(): at android.app.ActivityThread.main(ActivityThread.java:)
- ::56.236: E/AndroidRuntime(): at java.lang.reflect.Method.invokeNative(Native Method)
- ::56.236: E/AndroidRuntime(): at java.lang.reflect.Method.invoke(Method.java:)
- ::56.236: E/AndroidRuntime(): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:)
- ::56.236: E/AndroidRuntime(): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:)
- ::56.236: E/AndroidRuntime(): at dalvik.system.NativeStart.main(Native Method)
so名错误
(6)成功的log
- ::22.966: I/NoManagerActivity(): initUI sucess...
- ::22.966: I/NoManagerActivity(): OpenCV library load!
- ::22.966: D/OpenCV/StaticHelper(): Trying to get library list
- ::22.966: E/OpenCV/StaticHelper(): OpenCV error: Cannot load info library for OpenCV
- ::22.966: D/OpenCV/StaticHelper(): Library list: ""
- ::22.966: D/OpenCV/StaticHelper(): First attempt to load libs
- ::22.966: D/OpenCV/StaticHelper(): Trying to init OpenCV libs
- ::22.966: D/OpenCV/StaticHelper(): Trying to load library opencv_java
- ::22.966: D/dalvikvm(): Trying to load lib /data/app-lib/com.example.testopencv-/libopencv_java.so 0x41f4c9f8
- ::22.996: D/dalvikvm(): Added shared lib /data/app-lib/com.example.testopencv-/libopencv_java.so 0x41f4c9f8
- ::22.996: D/OpenCV/StaticHelper(): Library opencv_java loaded
- ::22.996: D/OpenCV/StaticHelper(): First attempt to load libs is OK
- ::22.996: I/OpenCV/StaticHelper(): General configuration for OpenCV 3.0.-rc1 =====================================
- ::22.996: I/OpenCV/StaticHelper(): Version control: 3.0.-rc1
- ::22.996: I/OpenCV/StaticHelper(): Platform:
- ::22.996: I/OpenCV/StaticHelper(): Host: Darwin 13.2. i386
- ::22.996: I/OpenCV/StaticHelper(): Target: Linux armv7-a
- ::22.996: I/OpenCV/StaticHelper(): CMake: 2.8.12.2
- ::22.996: I/OpenCV/StaticHelper(): CMake generator: Ninja
- ::22.996: I/OpenCV/StaticHelper(): CMake build tool: /usr/local/bin/ninja
- ::22.996: I/OpenCV/StaticHelper(): Configuration: Release
- ::22.996: I/OpenCV/StaticHelper(): C/C++:
- ::22.996: I/OpenCV/StaticHelper(): Built as dynamic libs?: NO
- ::22.996: I/OpenCV/StaticHelper(): C++ Compiler: /opt/android/android-ndk-r8e/toolchains/arm-linux-androideabi-4.7/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++ (ver 4.7)
- ::22.996: I/OpenCV/StaticHelper(): C++ flags (Release): -fexceptions -frtti -fpic -Wno-psabi --sysroot=/opt/android/android-ndk-r8e/platforms/android-/arch-arm -funwind-tables -finline-limit= -fsigned-char -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fdata-sections -ffunction-sections -Wa,--noexecstack -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -fomit-frame-pointer -fvisibility=hidden -fvisibility-inlines-hidden -mthumb -fomit-frame-pointer -fno-strict-aliasing -O3 -DNDEBUG -DNDEBUG
- ::22.996: I/OpenCV/StaticHelper(): C++ flags (Debug): -fexceptions -frtti -fpic -Wno-psabi --sysroot=/opt/android/android-ndk-r8e/platforms/android-/arch-arm -funwind-tables -finline-limit= -fsigned-char -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fdata-sections -ffunction-sections -Wa,--noexecstack -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -fomit-frame-pointer -fvisibility=hidden -fvisibility-inlines-hidden -marm -fno-omit-frame-pointer -fno-strict-aliasing -O0 -g -DDEBUG -D_DEBUG -O0 -DDEBUG -D_DEBUG
- ::22.996: I/OpenCV/StaticHelper(): C Compiler: /opt/android/android-ndk-r8e/toolchains/arm-linux-androideabi-4.7/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc
- ::22.996: I/OpenCV/StaticHelper(): C flags (Release): -fexceptions -fpic -Wno-psabi --sysroot=/opt/android/android-ndk-r8e/platforms/android-/arch-arm -funwind-tables -finline-limit= -fsigned-char -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fdata-sections -ffunction-sections -Wa,--noexecstack -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -fomit-frame-pointer -fvisibility=hidden -mthumb -fomit-frame-pointer -fno-strict-aliasing -O3 -DNDEBUG -DNDEBUG
- ::22.996: I/OpenCV/StaticHelper(): C flags (Debug): -fexceptions -fpic -Wno-psabi --sysroot=/opt/android/android-ndk-r8e/platforms/android-/arch-arm -funwind-tables -finline-limit= -fsigned-char -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fdata-sections -ffunction-sections -Wa,--noexecstack -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -fomit-frame-pointer -fvisibility=hidden -marm -fno-omit-frame-pointer -fno-strict-aliasing -O0 -g -DDEBUG -D_DEBUG -O0 -DDEBUG -D_DEBUG
- ::22.996: I/OpenCV/StaticHelper(): Linker flags (Release): -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now
- ::22.996: I/OpenCV/StaticHelper(): Linker flags (Debug): -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now
- ::22.996: I/OpenCV/StaticHelper(): Precompiled headers: YES
- ::23.006: I/OpenCV/StaticHelper(): OpenCV modules:
- ::23.006: I/OpenCV/StaticHelper(): To be built: hal core flann imgproc ml photo video androidcamera imgcodecs shape videoio highgui objdetect superres ts features2d calib3d java stitching videostab
- ::23.006: I/OpenCV/StaticHelper(): Disabled: world
- ::23.006: I/OpenCV/StaticHelper(): Disabled by dependency: -
- ::23.006: I/OpenCV/StaticHelper(): Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev python2 viz
- ::23.006: I/OpenCV/StaticHelper(): Android:
- ::23.006: I/OpenCV/StaticHelper(): Android ABI: armeabi-v7a
- ::23.006: I/OpenCV/StaticHelper(): STL type: gnustl_static
- ::23.006: I/OpenCV/StaticHelper(): Native API level: android-
- ::23.006: I/OpenCV/StaticHelper(): SDK target: android-
- ::23.006: I/OpenCV/StaticHelper(): Android NDK: /opt/android/android-ndk-r8e (toolchain: arm-linux-androideabi-4.7)
- ::23.006: I/OpenCV/StaticHelper(): android tool: /opt/android/android-sdk-macosx/tools/android (Android SDK Tools, revision 24.1..)
- ::23.006: I/OpenCV/StaticHelper(): Google Play package: YES
- ::23.006: I/OpenCV/StaticHelper(): Android examples: YES
- ::23.006: I/OpenCV/StaticHelper(): GUI:
- ::23.006: I/OpenCV/StaticHelper(): GTK+: NO
- ::23.006: I/OpenCV/StaticHelper(): GThread : NO
- ::23.006: I/OpenCV/StaticHelper(): GtkGlExt: NO
- ::23.006: I/OpenCV/StaticHelper(): OpenGL support: NO
- ::23.006: I/OpenCV/StaticHelper(): VTK support: NO
- ::23.006: I/OpenCV/StaticHelper(): Media I/O:
- ::23.006: I/OpenCV/StaticHelper(): ZLib: z (ver 1.2.)
- ::23.006: I/OpenCV/StaticHelper(): JPEG: build (ver )
- ::23.006: I/OpenCV/StaticHelper(): WEBP: build (ver 0.3.)
- ::23.006: I/OpenCV/StaticHelper(): PNG: build (ver 1.5.)
- ::23.006: I/OpenCV/StaticHelper(): TIFF: build (ver - 4.0.)
- ::23.006: I/OpenCV/StaticHelper(): JPEG : build (ver 1.900.)
- ::23.006: I/OpenCV/StaticHelper(): OpenEXR: build (ver 1.7.)
- ::23.006: I/OpenCV/StaticHelper(): GDAL: NO
- ::23.006: I/OpenCV/StaticHelper(): Video I/O:
- ::23.006: I/OpenCV/StaticHelper(): AndroidNativeCamera: YES, use prebuilt libraries
- ::23.006: I/OpenCV/StaticHelper(): Other third-party libraries:
- ::23.006: I/OpenCV/StaticHelper(): Use IPP: NO
- ::23.006: I/OpenCV/StaticHelper(): Use Eigen: NO
- ::23.006: I/OpenCV/StaticHelper(): Use TBB: YES (ver 4.1 interface )
- ::23.006: I/OpenCV/StaticHelper(): Use OpenMP: NO
- ::23.006: I/OpenCV/StaticHelper(): Use GCD NO
- ::23.006: I/OpenCV/StaticHelper(): Use Concurrency NO
- ::23.006: I/OpenCV/StaticHelper(): Use C=: NO
- ::23.006: I/OpenCV/StaticHelper(): Use Cuda: NO
- ::23.006: I/OpenCV/StaticHelper(): Use OpenCL: NO
- ::23.006: I/OpenCV/StaticHelper(): Python :
- ::23.006: I/OpenCV/StaticHelper(): Interpreter: /usr/bin/python2. (ver 2.7.)
- ::23.006: I/OpenCV/StaticHelper(): Python :
- ::23.006: I/OpenCV/StaticHelper(): Interpreter: NO
- ::23.006: I/OpenCV/StaticHelper(): Python (for build): /usr/bin/python2.
- ::23.006: I/OpenCV/StaticHelper(): Java:
- ::23.006: I/OpenCV/StaticHelper(): ant: /usr/local/bin/ant (ver 1.9.)
- ::23.006: I/OpenCV/StaticHelper(): Java wrappers: YES
- ::23.006: I/OpenCV/StaticHelper(): Java tests: NO
- ::23.006: I/OpenCV/StaticHelper(): Matlab:
- ::23.006: I/OpenCV/StaticHelper(): mex: NO
- ::23.006: I/OpenCV/StaticHelper(): Documentation:
- ::23.006: I/OpenCV/StaticHelper(): Doxygen: NO
- ::23.006: I/OpenCV/StaticHelper(): PlantUML: NO
- ::23.006: I/OpenCV/StaticHelper(): Tests and samples:
- ::23.006: I/OpenCV/StaticHelper(): Tests: NO
- ::23.006: I/OpenCV/StaticHelper(): Performance tests: NO
- ::23.006: I/OpenCV/StaticHelper(): C/C++ Examples: NO
- ::23.006: I/OpenCV/StaticHelper(): Install path: /builds/master_pack-android/build/o4a/install
- ::23.006: I/OpenCV/StaticHelper(): cvconfig.h is in: /builds/master_pack-android/build/o4a
- ::23.006: I/OpenCV/StaticHelper(): -----------------------------------------------------------------
- ::23.006: D/dalvikvm(): Trying to load lib /data/app-lib/com.example.testopencv-/libopencv_java.so 0x41f4c9f8
- ::23.006: D/dalvikvm(): Shared lib '/data/app-lib/com.example.testopencv-1/libopencv_java.so' already loaded in same CL 0x41f4c9f8
- ::23.006: I/NoManagerActivity(): start loading libTestOpenCV
- ::23.006: D/dalvikvm(): Trying to load lib /data/app-lib/com.example.testopencv-/libTestOpenCV.so 0x41f4c9f8
- ::23.006: D/dalvikvm(): Added shared lib /data/app-lib/com.example.testopencv-/libTestOpenCV.so 0x41f4c9f8
- ::23.006: D/dalvikvm(): No JNI_OnLoad found in /data/app-lib/com.example.testopencv-/libTestOpenCV.so 0x41f4c9f8, skipping init
- ::23.006: I/NoManagerActivity(): finish loading libTestOpenCV
- ::23.006: I/NoManagerActivity(): 成功加载
- ::23.046: D/libEGL(): loaded /vendor/lib/egl/libEGL_adreno.so
- ::23.046: D/libEGL(): loaded /vendor/lib/egl/libGLESv1_CM_adreno.so
- ::23.056: D/libEGL(): loaded /vendor/lib/egl/libGLESv2_adreno.so
- ::23.056: I/Adreno-EGL(): <qeglDrvAPI_eglInitialize:>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_JB_3.2.1.4_RB1.04.03.00.187.021_msm8226_JB_3.2.1.4_RB1__release_AU ()
- ::23.056: I/Adreno-EGL(): OpenGL ES Shader Compiler Version: 20.00.
- ::23.056: I/Adreno-EGL(): Build Date: // Fri
- ::23.056: I/Adreno-EGL(): Local Branch: mybranch3810467
- ::23.056: I/Adreno-EGL(): Remote Branch: quic/jb_3.2.1.4_rb1
- ::23.056: I/Adreno-EGL(): Local Patches: NONE
- ::23.056: I/Adreno-EGL(): Reconstruct Branch: AU_LINUX_ANDROID_JB_3.2.1.4_RB1.04.03.00.187. + NOTHING
- ::23.086: D/OpenGLRenderer(): Enabling debug mode
成功的Log
(7)当把
Log.i(TAG,"OpenCV library load!");
if (!OpenCVLoader.initDebug()) {
Log.i(TAG,"OpenCV load not successfully");
// OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback);
} else {
// System.loadLibrary("opencv_java");
Log.i(TAG,"start loading libTestOpenCV");
System.loadLibrary("TestOpenCV");// load other libraries
Log.i(TAG,"finish loading libTestOpenCV");
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
}
修改为
Log.i(TAG,"OpenCV library load!");
System.loadLibrary("opencv_java");
Log.i(TAG,"start loading libTestOpenCV");
System.loadLibrary("TestOpenCV");// load other libraries
Log.i(TAG,"finish loading libTestOpenCV");
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
即跳过 OpenCVLoader.initDebug()过程,打出的log如下:
- ::58.616: I/NoManagerActivity(): initUI sucess...
- ::58.616: I/NoManagerActivity(): OpenCV library load!
- ::58.616: D/dalvikvm(): Trying to load lib /data/app-lib/com.example.testopencv-/libopencv_java.so 0x41f4b640
- ::58.616: D/dalvikvm(): Shared lib '/data/app-lib/com.example.testopencv-2/libopencv_java.so' already loaded in same CL 0x41f4b640
- ::58.616: I/NoManagerActivity(): start loading libTestOpenCV
- ::58.616: D/dalvikvm(): Trying to load lib /data/app-lib/com.example.testopencv-/libTestOpenCV.so 0x41f4b640
- ::58.616: D/dalvikvm(): Shared lib '/data/app-lib/com.example.testopencv-2/libTestOpenCV.so' already loaded in same CL 0x41f4b640
- ::58.616: I/NoManagerActivity(): finish loading libTestOpenCV
- ::58.616: I/NoManagerActivity(): 成功加载
Log少了很多(仅为测试)
(8)调试中发现,官方给的Sample中。只用java层接口,没用jni层的例子。比如 OpenCV Sample - image-manipulations
只需要拷进去一个Libopencv_java.so,然后注释掉onResume函数中的initAsync这句。不用OpenCVManager就可以运行了
(怀疑如果功能增多需要拷进去其他so)
@Override
public void onResume()
{
super.onResume();
if (!OpenCVLoader.initDebug()) {
Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
// OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback);
} else {
Log.d(TAG, "OpenCV library found inside package. Using it!");
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
}
}
OpenCV4Android 不需要安装OpenCVManager,就可以运行的方法的更多相关文章
- 关于SQL Server 安装程序在运行 Windows Installer 文件时遇到错误
前几日安装sql server2008r2 的时候碰到这个问题: 出现以下错误: SQL Server 安装程序在运行 Windows Installer 文件时遇到错误. Windows Insta ...
- Android Studio安装及首次运行遇到的问题
Android Studio,下载地址:http://developer.android.com/sdk/index.html.需要注意的是Android Studio需要JDK 1.7+才可以安装, ...
- 如何快速正确的安装 Ruby, Rails 运行环境
如何快速正确的安装 Ruby, Rails 运行环境 https://ruby-china.org/wiki/install_ruby_guide 对于新入门的开发者,如何安装 Ruby, Ruby ...
- android开发(0):android studio的下载安装与简单使用 | sdk的安装与编译运行
android studio,简称AS,是集成开发环境,所谓集成,就是集编辑.编译.调试.打包等于一体.简单来说,通过AS,就可以开发出在android系统上运行的APP. 我使用的是macos系统. ...
- [Docker] Win10中安装Docker并运行Nginx镜像
一.安装Docker 进入官网:https://www.docker.com/products/docker-desktop 可能需要先注册登录,很简单的. 点击 Download Desktop f ...
- Windows下将nginx安装为服务运行
今天看到nginx这个小服务器软件正式版更新到了1.4.2,想玩下它.这个服务器软件虽小,但功能强大,是开源软件,有着良好的性能,被很多个人.企业,甚至大型企业所使用! 由于是在Windows下,所以 ...
- Zend Server安装后首次运行就出现Internal Server Error的解决(转)
新近学习php,结果装了Zend Server上来就报错,网上找到了解决方法,照着做果然可行,转之. 刚才安装了Zend Server,安装后首次运行就爆出了一个Internal Server Err ...
- 安装nodejs 后运行 npm 命令无响应处理方法
安装和卸载过nodejs, 也编辑过 C:\Users\{账户}\下的.npmrc文件. 再全新安装nodejs ,运行npm 命令,无响应. 处理方法,删除C:\Users\{账户}\下的.npmr ...
- 安装GNUstep并运行第一个objc程序
在windows环境下安装GNUstep,运行objective-c程序,今天试了一下,记录一下操作步骤, 1,登陆http://ftpmain.gnustep.org/pub/gnustep/bin ...
随机推荐
- (四) tensorflow笔记:常用函数说明
tensorflow笔记系列: (一) tensorflow笔记:流程,概念和简单代码注释 (二) tensorflow笔记:多层CNN代码分析 (三) tensorflow笔记:多层LSTM代码分析 ...
- CentOS 6.6 中 mysql_5.6 主从数据库配置
[mysql5.6 主从复制] 1.配置主从节点的服务配置文件 1.1.配置master节点 [mysqld] binlog-format=row log-bin=master-bin log-sla ...
- android将drawable下的图片转换成bitmap
将drawable下的图片转换成bitmap 1. Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.xx ...
- Kali 2.0 日常软件
目的 如果你用Kali作为学习安全之类的作业,那么他预装的一些软件已经够用了,但是,如果你打算用它来当做日常主要OS,那么安装一些常用软件就是一项重要作业. 软件 如果你是在标准用户下安装,别忘了su ...
- 线程存储(Thread Specific Data)
线程中特有的线程存储, Thread Specific Data .线程存储有什么用了?他是什么意思了? 大家都知道,在多线程程序中,所有线程共享程序中的变量.现在有一全局变量,所有线程都可以使用它, ...
- Linux命令学习(17):ifconfig命令
版权声明更新:2017-05-22博主:LuckyAlan联系:liuwenvip163@163.com声明:吃水不忘挖井人,转载请注明出处! 1 文章介绍 我们知道,在windows中,除了在图形界 ...
- LeetCode Number of Longest Increasing Subsequence
原题链接在这里:https://leetcode.com/problems/number-of-longest-increasing-subsequence/description/ 题目: Give ...
- php 服务器的安全笔记
php 服务器的安全笔记 操作系统安全 默认端口修改 MySQL 端口禁止外网访问 用户权限 父进程 子进程 目录权限 TODO Web Server 版本信息 服务器版本信息 PHP 版本 open ...
- bzoj 4300 绝世好题——DP
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=4300 考虑 dp[ i ] 能从哪些 j 转移过来,就是那些 a[ j ] & a[ ...
- linux 定时备份mysql
定时备份:1.创建备份文件存放目录2.创建备份脚本backup.sh #!/bin/bash DBUser=db_backDBPasswd=passwordDBName=db_nameSERVER=l ...