Ask Your Question

Revision history [back]

How to connect opencv for qt+android

Can't use opencv. Using QT5. My .pro file: ` <hb> QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT
+= widgets

TARGET = Alpha TEMPLATE = app
SOURCES += main.cpp \
    firstwindow.cpp

HEADERS  += \
    firstwindow.h

-- 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
opencv2/core/core.hpp
opencv2/imgproc/imgproc.hpp

LIBS +=
E:\OpenCVAndroid\OpenCV-android-sdk\sdk\native\libs\armeabi-v7a\\\* INCLUDEPATH +=
E:\OpenCVAndroid\OpenCV-android-sdk\sdk\native\native\jni\include\
CONFIG += mobility MOBILITY =

ANDROID_EXTRA_LIBS =


ANDROID_OPENCV =
E:/OpenCVAndroid/OpenCV-android-sdk/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 @

When you try to connect

include <opencv2/core/core.hpp>
 include <opencv2/highgui/highgui.hpp>

Error: E:\ForAndroid\Project\SAlpha\SAlpha\main.cpp:6: ошибка: opencv2/core/core.hpp: No such file or directory #include <opencv2 core="" core.hpp=""> ^

What and where, you need to write to use the opencv: cap = new cv::VideoCapture(0);

Apologize for broken English)