Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Use OpenCV Android with qt 5.1



  • Hi,
    I'm trying to access the camera on android using opencv, but unfortunatly I can't get any qt Apps using OpenCv to run on my android phone.
    If I try to do it I get
    "Your application has encountered a fatal error and cannot continue."
    and the app just stops. This error occurs the moment the screen on the tablet goes black for the App deployment.

    I am using the prebuilt Version of OpenCV 2.4.6 for Android
    http://garr.dl.sourceforge.net/project/opencvlibrary/opencv-android/2.4.6/OpenCV-2.4.6-android-sdk-r2.zip

    my .pro File looks like this.

    @
    QT += core
    QT -= gui
    TARGET = myFirstOpenCVProject
    CONFIG += console
    CONFIG -= app_bundle
    TEMPLATE = app
    SOURCES += main.cpp

    OTHER_FILES +=
    android/AndroidManifest.xml
    android/res/layout/splash.xml
    android/res/values/libs.xml
    android/res/values/strings.xml
    android/res/values-de/strings.xml
    android/res/values-el/strings.xml
    android/res/values-es/strings.xml
    android/res/values-et/strings.xml
    android/res/values-fa/strings.xml
    android/res/values-fr/strings.xml
    android/res/values-id/strings.xml
    android/res/values-it/strings.xml
    android/res/values-ja/strings.xml
    android/res/values-ms/strings.xml
    android/res/values-nb/strings.xml
    android/res/values-nl/strings.xml
    android/res/values-pl/strings.xml
    android/res/values-pt-rBR/strings.xml
    android/res/values-ro/strings.xml
    android/res/values-rs/strings.xml
    android/res/values-ru/strings.xml
    android/res/values-zh-rCN/strings.xml
    android/res/values-zh-rTW/strings.xml
    android/src/org/kde/necessitas/ministro/IMinistro.aidl
    android/src/org/kde/necessitas/ministro/IMinistroCallback.aidl
    android/src/org/qtproject/qt5/android/bindings/QtActivity.java
    android/src/org/qtproject/qt5/android/bindings/QtApplication.java
    android/version.xml

    ANDROID_OPENCV = C:/qt/openCV/sdk/native
    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/3rdparty/libs/armeabi-v7a/liblibjpeg.a
    $$ANDROID_OPENCV/3rdparty/libs/armeabi-v7a/liblibpng.a
    $$ANDROID_OPENCV/3rdparty/libs/armeabi-v7a/liblibtiff.a
    $$ANDROID_OPENCV/3rdparty/libs/armeabi-v7a/liblibjasper.a
    $$ANDROID_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/jni/include/opencv/
    INCLUDEPATH += $$ANDROID_OPENCV/jni/include/opencv2/
    INCLUDEPATH += $$ANDROID_OPENCV/jni/include/

    CONFIG+=link_pkgconfig PKGCONFIG+=opencv
    @

    Can you see a reason for the error?
    Thanks in advance!



  • Maybe check adb logcat
    There you gonna see some error message when the app crashes


Log in to reply