无法在 Qt 中链接 OpenCV Android [英] Cannot link OpenCV Android inside Qt

查看:78
本文介绍了无法在 Qt 中链接 OpenCV Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在 Qt 中使用带有 Android 的 OpenCV,但我无法在 Qt 中成功链接它,我收到了一些未定义的对侧库(如 libjpeg、libtegra_hal 等)的引用错误.我使用 这个 SO 答案 作为参考指南.

I tried to use OpenCV with Android inside Qt, but I cannot successfully link it inside Qt, I get some undefined reference errors to the side libraries (like libjpeg, libtegra_hal etc.). I used this SO answer as a reference guide.

这是我的 .pro 文件 -

This is my .pro file -

INCLUDEPATH += "$$PWD/../../External-Libraries/opencv-android/sdk/native/jni/include"

android {
# 3rd party libs
LIBS += \
    -L"$$PWD/../../External-Libraries/opencv-android/sdk/native/3rdparty/libs/armeabi-v7a"\
    -llibtiff\
    -llibjpeg\
    -llibjasper\
    -llibpng\
    -llibwebp\
    -lIlmImf\
    -ltbb\
    -ltegra_hal
# opencv libs
LIBS += -L"$$PWD/../../External-Libraries/opencv-android/sdk/native/libs/armeabi-v7a"\
    -lopencv_core\
    -lopencv_highgui\
    -lopencv_java3\
    -lopencv_calib3d\
    -lopencv_imgcodecs\
    -lopencv_imgproc\
    -lopencv_flann\
    -lopencv_features2d\
    -lopencv_ml\
    -lopencv_objdetect\
    -lopencv_photo\
    -lopencv_shape\
    -lopencv_stitching\
    -lopencv_superres\
    -lopencv_video\
    -lopencv_videoio\
    -lopencv_videostab
ANDROID_PACKAGE_SOURCE_DIR=$$PWD/android
}

我使用的是 Qt 5.8 和 OpenCV 3.2.0.错误是这种格式 -

I'm using Qt 5.8 and OpenCV 3.2.0. The errors are in this format -

libopencv_core.a: ... 错误:未定义引用(第 3 方库之一的方法)

这是一个例子 -

libopencv_core.a(arithm.cpp.o):arithm.cpp:function cv::hal::cmp8u(unsigned char const*, unsigned int, unsigned char const*, unsigned int, unsigned char*, unsigned int,int, int, void*): 错误:未定义对 'carotene_o4t::isSupportedConfiguration()' 的引用

libopencv_core.a(arithm.cpp.o):arithm.cpp:function cv::hal::cmp8u(unsigned char const*, unsigned int, unsigned char const*, unsigned int, unsigned char*, unsigned int, int, int, void*): error: undefined reference to 'carotene_o4t::isSupportedConfiguration()'

其中carotenelibtegra_hal.a 的函数.有没有办法将 opencv 库与 3rd 方库链接起来?

Where carotene is a function of libtegra_hal.a. Is there any way to link the opencv libs with the 3rd party libs?

谢谢.

我可以成功编译和运行 OpenCV 3.1.0 库,但不能成功编译和运行 3.2.0 库.

I can successfully compile and run the OpenCV 3.1.0 library, but not the 3.2.0 library.

推荐答案

解决方法是:使用 OpenCV 3.1.0 或更低版本,或者在禁用 CAROTENE 的情况下编译 OpenCV 3.2.0.

The workaround is: either use OpenCV 3.1.0 or older or compile OpenCV 3.2.0 with CAROTENE disabled.

我现在似乎找不到任何其他解决方案.

I can't seem to find any other solutions for now.

这篇关于无法在 Qt 中链接 OpenCV Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆