4

OpenCV で Qt Android アプリを作成したいと考えています。Ubuntu 12.04 (64 ビット) で Necessitas Qt Creator と OpenCV 2.4.0 Android バイナリ パッケージを使用しています。現時点では、OpenCV Mat オブジェクトを作成するだけです。

しかし、プロジェクトをコンパイルしているときに、tbb 関数の「未定義の参照」エラーが発生します。

> /home/kolbe/src/android-sdk-linux/OpenCV-2.4.0/libs/armeabi-v7a/libopencv_core.a(stat.cpp.o):-1: In function tbb::interface6::internal::start_for<tbb::blocked_range<int>, cv::BatchDistInvoker, tbb::auto_partitioner>::execute():
stat.cpp:-1: error: undefined reference to tbb::internal::allocate_continuation_proxy::allocate(unsigned int) const
stat.cpp:-1: error: undefined reference to tbb::internal::allocate_continuation_proxy::allocate(unsigned int) const
...

*.pro / qmake ファイルに OpenCV ライブラリ (libtbb.a も) を含めています。

ANDROID_OPENCV = /home/kolbe/src/android-sdk-linux/OpenCV-2.4.0
LIBS += \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_calib3d.a \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_flann.a \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_objdetect.a \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_contrib.a \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_video.a \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_ml.a \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_legacy.a \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_highgui.a \
$$ANDROID_OPENCV/share/OpenCV/3rdparty/libs/armeabi-v7a/liblibjpeg.a \
$$ANDROID_OPENCV/share/OpenCV/3rdparty/libs/armeabi-v7a/liblibpng.a \
$$ANDROID_OPENCV/share/OpenCV/3rdparty/libs/armeabi-v7a/liblibtiff.a \
$$ANDROID_OPENCV/share/OpenCV/3rdparty/libs/armeabi-v7a/liblibjasper.a \
$$ANDROID_OPENCV/share/OpenCV/3rdparty/libs/armeabi-v7a/libtbb.a \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_ts.a \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_imgproc.a \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_core.a \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_androidcamera.a \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_features2d.a

INCLUDEPATH += $$ANDROID_OPENCV/include/opencv/
INCLUDEPATH += $$ANDROID_OPENCV/include/opencv2/
INCLUDEPATH += $$ANDROID_OPENCV/include/

CONFIG+=link_pkgconfig PKGCONFIG+=opencv

OpenCV が tbb 関数を見つけられないのはなぜですか? ありがとう!

4

2 に答える 2

2

ライブラリの順序は、リンクにとって重要です。次の方法で行を並べ替えてみてください。

LIBS += \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_contrib.a \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_legacy.a \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_ml.a \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_objdetect.a \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_calib3d.a \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_video.a \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_features2d.a \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_highgui.a \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_androidcamera.a \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_flann.a \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_imgproc.a \
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_core.a \
$$ANDROID_OPENCV/share/OpenCV/3rdparty/libs/armeabi-v7a/liblibjpeg.a \
$$ANDROID_OPENCV/share/OpenCV/3rdparty/libs/armeabi-v7a/liblibpng.a \
$$ANDROID_OPENCV/share/OpenCV/3rdparty/libs/armeabi-v7a/liblibtiff.a \
$$ANDROID_OPENCV/share/OpenCV/3rdparty/libs/armeabi-v7a/liblibjasper.a \
$$ANDROID_OPENCV/share/OpenCV/3rdparty/libs/armeabi-v7a/libtbb.a
于 2013-06-25T22:36:06.263 に答える
0

次の方法を試すことができます...それは私にとってはうまくいきました

libopencv_java.so を QT_INSTALLDIR/5.1.1/android_armv7/lib にコピーし、以下を .pro LIBS += -lopencv_java に追加します

于 2013-09-12T11:58:04.973 に答える