How to use OpenCV 3.0 on Android QT 5.6 project



  • I would like to use OpenCV 3.0 on Android QT project.

    After download OpenCV Android SDK, I've tried to compile with the native interface, but always give some kind of error. Only declaring a variable gives errors:

    main.cpp:
    #include <opencv2/opencv.hpp>
    int main(int argc, char* argv[])
    {
           cv::Mat edges;
    }
    

    The pro file has the include and libs vars:

    OPENCV_PATH = D:/programacio/libs/OpenCV/OpenCV-android-sdk/sdk/native
    INCLUDEPATH += $${OPENCV_PATH}/jni/include
    android {
        LIBS += \
            -L"$${OPENCV_PATH}/3rdparty/libs/armeabi-v7a"\
            -L"$${OPENCV_PATH}/libs/armeabi-v7a"\
            -lopencv_core
    }
    

    but gives this errors:

    D:/programacio/libs/OpenCV/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(parallel.cpp.o):parallel.cpp:function tbb::interface7::internal::start_for<tbb::blocked_range<int>, (anonymous namespace)::ProxyLoopBody, tbb::auto_partitioner const>::~start_for(): error: undefined reference to 'vtable for tbb::task'
    c:/android/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld.exe: the vtable symbol may be undefined because the class is missing its key function
    D:/programacio/libs/OpenCV/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(parallel.cpp.o):parallel.cpp:function tbb::interface7::internal::flag_task::~flag_task(): error: undefined reference to 'vtable for tbb::task'
    c:/android/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld.exe: the vtable symbol may be undefined because the class is missing its key function
    D:/programacio/libs/OpenCV/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(parallel.cpp.o):parallel.cpp:function tbb::interface7::internal::start_for<tbb::blocked_range<int>, (anonymous namespace)::ProxyLoopBody, tbb::auto_partitioner const>::~start_for(): error: undefined reference to 'vtable for tbb::task'
    c:/android/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld.exe: the vtable symbol may be undefined because the class is missing its key function
    D:/programacio/libs/OpenCV/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(parallel.cpp.o):parallel.cpp:function tbb::interface7::internal::flag_task::~flag_task(): error: undefined reference to 'vtable for tbb::task'
    c:/android/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld.exe: the vtable symbol may be undefined because the class is missing its key function
    D:/programacio/libs/OpenCV/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(parallel.cpp.o):parallel.cpp:function tbb::task_scheduler_init::~task_scheduler_init(): error: undefined reference to 'tbb::task_scheduler_init::terminate()'
    D:/programacio/libs/OpenCV/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(parallel.cpp.o):parallel.cpp:function tbb::interface7::internal::start_for<tbb::blocked_range<int>, (anonymous namespace)::ProxyLoopBody, tbb::auto_partitioner const>::execute(): error: undefined reference to 'tbb::internal::allocate_continuation_proxy::allocate(unsigned int) const'
    D:/programacio/libs/OpenCV/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(parallel.cpp.o):parallel.cpp:function tbb::interface7::internal::start_for<tbb::blocked_range<int>, (anonymous namespace)::ProxyLoopBody, tbb::auto_partitioner const>::execute(): error: undefined reference to 'tbb::internal::allocate_child_proxy::allocate(unsigned int) const'
    D:/programacio/libs/OpenCV/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(parallel.cpp.o):parallel.cpp:function tbb::interface7::internal::start_for<tbb::blocked_range<int>, (anonymous namespace)::ProxyLoopBody, tbb::auto_partitioner const>::execute(): error: undefined reference to 'tbb::internal::allocate_continuation_proxy::allocate(unsigned int) const'
    D:/programacio/libs/OpenCV/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(parallel.cpp.o):parallel.cpp:function tbb::interface7::internal::start_for<tbb::blocked_range<int>, (anonymous namespace)::ProxyLoopBody, tbb::auto_partitioner const>::execute(): error: undefined reference to 'tbb::internal::allocate_child_proxy::allocate(unsigned int) const'
    makefile:70: recipe for target 'libOpenCVTest.so' failed
    D:/programacio/libs/OpenCV/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(parallel.cpp.o):parallel.cpp:function tbb::interface7::internal::start_for<tbb::blocked_range<int>, (anonymous namespace)::ProxyLoopBody, tbb::auto_partitioner const>::execute(): error: undefined reference to 'tbb::task_group_context::is_group_execution_cancelled() const'
    D:/programacio/libs/OpenCV/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(parallel.cpp.o):parallel.cpp:function cv::parallel_for_(cv::Range const&, cv::ParallelLoopBody const&, double): error: undefined reference to 'tbb::task_group_context::init()'
    D:/programacio/libs/OpenCV/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(parallel.cpp.o):parallel.cpp:function cv::parallel_for_(cv::Range const&, cv::ParallelLoopBody const&, double): error: undefined reference to 'tbb::internal::allocate_root_with_context_proxy::allocate(unsigned int) const'
    D:/programacio/libs/OpenCV/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(parallel.cpp.o):parallel.cpp:function cv::parallel_for_(cv::Range const&, cv::ParallelLoopBody const&, double): error: undefined reference to 'tbb::internal::get_initial_auto_partitioner_divisor()'
    D:/programacio/libs/OpenCV/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(parallel.cpp.o):parallel.cpp:function cv::parallel_for_(cv::Range const&, cv::ParallelLoopBody const&, double): error: undefined reference to 'tbb::task_group_context::~task_group_context()'
    D:/programacio/libs/OpenCV/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(parallel.cpp.o):parallel.cpp:function cv::parallel_for_(cv::Range const&, cv::ParallelLoopBody const&, double): error: undefined reference to 'tbb::internal::allocate_root_with_context_proxy::free(tbb::task&) const'
    D:/programacio/libs/OpenCV/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(parallel.cpp.o):parallel.cpp:function cv::parallel_for_(cv::Range const&, cv::ParallelLoopBody const&, double): error: undefined reference to 'tbb::task_group_context::~task_group_context()'
    D:/programacio/libs/OpenCV/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(parallel.cpp.o):parallel.cpp:function cv::getNumThreads(): error: undefined reference to 'tbb::task_scheduler_init::default_num_threads()'
    D:/programacio/libs/OpenCV/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(parallel.cpp.o):parallel.cpp:function cv::setNumThreads(int): error: undefined reference to 'tbb::task_scheduler_init::terminate()'
    D:/programacio/libs/OpenCV/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(parallel.cpp.o):parallel.cpp:function cv::setNumThreads(int): error: undefined reference to 'tbb::task_scheduler_init::initialize(int)'
    D:/programacio/libs/OpenCV/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(parallel.cpp.o):parallel.cpp:function _GLOBAL__sub_I_parallel.cpp: error: undefined reference to 'tbb::task_scheduler_init::initialize(int, unsigned int)'
    D:/programacio/libs/OpenCV/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(parallel.cpp.o):parallel.cpp:typeinfo for tbb::interface7::internal::flag_task: error: undefined reference to 'typeinfo for tbb::task'
    D:/programacio/libs/OpenCV/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(parallel.cpp.o):parallel.cpp:vtable for tbb::interface7::internal::flag_task: error: undefined reference to 'tbb::task::note_affinity(unsigned short)'
    D:/programacio/libs/OpenCV/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_core.a(parallel.cpp.o):parallel.cpp:typeinfo for tbb::interface7::internal::start_for<tbb::blocked_range<int>, (anonymous namespace)::ProxyLoopBody, tbb::auto_partitioner const>: error: undefined reference to 'typeinfo for tbb::task'
    collect2.exe: error: ld returned 1 exit status
    

    How can I use it?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.