Android add Native OpenCV

asked 2016-10-14 06:47:21 -0500

Vintez gravatar image

I made a console application in c++ and want to add it now to Android. I already configured everything and added a JNIInterface for my SourceFiles.

After that I builded OpenCV Libraries for Android and added the following code from the Face-detection Example and configured it for my locations of the OpenCV.mk File.

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

#OPENCV_CAMERA_MODULES:=off
#OPENCV_INSTALL_MODULES:=off
#OPENCV_LIB_TYPE:=SHARED
ifdef OPENCV_ANDROID
    ifneq ("","$(wildcard $(OPENCV_ANDROID_SDK)/OpenCV.mk)")
        include ${OPENCV_ANDROID)/OpenCV.mk
    else
        include ${OPENCV_ANDROID}/OpenCV.mk
    endif
else
    include /Users/mtuchner/Desktop/opencv-master/platforms/build_android_arm/unix-install/OpenCV.mk
endif

LOCAL_SRC_FILES := ExtractorManager.cpp hpoint.cpp hrect.cpp JNIInterface.cpp kdnode.cpp kdtree.cpp KdtreeManager.cpp nnl.cpp priorityQueue.cpp
LOCAL_C_INCLUDES += $(LOCAL_PATH)
LOCAL_LDLIBS += -llog -ldl

LOCAL_MODULE := fast_sift_detector

include $(BUILD_SHARED_LIBRARY)

Also I set the Application.mk:

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions -std=c++11
APP_ABI := armeabi-v7a
APP_PLATFORM := android-8

Then I started the building with the ndk-build But it seems, like I am missing something... it gives me this Errors, and says, that it cant find methods which I use in my sourcefiles. Does anyone know what is wrong there?

Here is the complete Error Message:

/Users/mtuchner/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lopencv_java3
/Users/mtuchner/Desktop/FASTSIFT/app/src/main/jni/ExtractorManager.cpp:54: error: undefined reference to 'cv::hal::exp32f(float const*, float*, int)'
/Users/mtuchner/Desktop/FASTSIFT/app/src/main/jni/ExtractorManager.cpp:55: error: undefined reference to 'cv::hal::fastAtan2(float const*, float const*, float*, int, bool)'
/Users/mtuchner/Desktop/FASTSIFT/app/src/main/jni/ExtractorManager.cpp:56: error: undefined reference to 'cv::hal::magnitude32f(float const*, float const*, float*, int)'
/Users/mtuchner/Desktop/FASTSIFT/app/src/main/jni/ExtractorManager.cpp:145: error: undefined reference to 'cv::hal::fastAtan32f(float const*, float const*, float*, int, bool)'
/Users/mtuchner/Desktop/FASTSIFT/app/src/main/jni/ExtractorManager.cpp:146: error: undefined reference to 'cv::hal::magnitude32f(float const*, float const*, float*, int)'
/Users/mtuchner/Desktop/FASTSIFT/app/src/main/jni/ExtractorManager.cpp:147: error: undefined reference to 'cv::hal::exp32f(float const*, float*, int)'
/Users/mtuchner/Desktop/FASTSIFT/app/src/main/jni/ExtractorManager.cpp:254: error: undefined reference to 'cv::resize(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double, double, int)'
/Users/mtuchner/Desktop/FASTSIFT/app/src/main/jni/ExtractorManager.cpp:256: error: undefined reference to 'cv::GaussianBlur(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double, double, int)'
/Users/mtuchner/Desktop/FASTSIFT/app/src/main/jni/ExtractorManager.cpp:258: error: undefined reference to 'cv::FAST(cv::_InputArray const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, int, bool)'
/Users/mtuchner/Desktop/FASTSIFT/app/src/main/jni/ExtractorManager.cpp:260: error: undefined reference to 'cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const'
/usr/local/include/opencv2/core/mat.inl.hpp:647: error: undefined reference to 'cv::Mat::copyTo(cv::_OutputArray const&) const'
/usr/local/include/opencv2/core/mat.inl.hpp:687: error: undefined reference to 'cv ...
(more)
edit retag flag offensive close merge delete