Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Opencv in Android
Forum Updated to NodeBB v4.3 + New Features

Opencv in Android

Scheduled Pinned Locked Moved Solved Mobile and Embedded
12 Posts 3 Posters 5.1k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    OliveiraNT
    wrote on 25 Jul 2016, 19:21 last edited by OliveiraNT 8 Jan 2016, 19:58
    #1

    I'm trying to use the openCV libraries in a android application but I'm having problems to do this, someone knows a way to do this work?

    Edit: I'm using ubuntu 14.04, Qt 5.7 and OpenCV 3.0.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 25 Jul 2016, 21:16 last edited by
      #2

      Hi,

      That's a bit vague. What did you try ? What errors are you getting ? Can you make a "pure" OpenCV sample application run on your Android device ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • O Offline
        O Offline
        OliveiraNT
        wrote on 26 Jul 2016, 18:50 last edited by OliveiraNT
        #3

        I just followed this tutorial but when a try it I'm still not able to include OpenCV libraries in my project and I receive the message "No such file or directory"

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 26 Jul 2016, 21:33 last edited by
          #4

          Can you share you .pro file and what file isn't found ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • O Offline
            O Offline
            OliveiraNT
            wrote on 27 Jul 2016, 16:34 last edited by OliveiraNT
            #5

            Sure, actually my .pro file is

            TEMPLATE = app
            
            QT += qml quick
            CONFIG += c++11
            
            SOURCES += main.cpp \
                imagerecog.cpp
            
            INCLUDEPATH += /usr/local/include/opencv
            LIBS += -L/usr/local/lib -lopencv_core -lopencv_imgcodecs -lopencv_highgui
            
            RESOURCES += qml.qrc
            
            
            # Additional import path used to resolve QML modules in Qt Creator's code model
            QML_IMPORT_PATH =
            
            # Default rules for deployment.
            include(deployment.pri)
            
            DISTFILES += \
                android/AndroidManifest.xml \
                android/gradle/wrapper/gradle-wrapper.jar \
                android/gradlew \
                android/res/values/libs.xml \
                android/build.gradle \
                android/gradle/wrapper/gradle-wrapper.properties \
                android/gradlew.bat
            
            ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
            
            HEADERS += \
                imagerecog.h
            
            

            And the error happens when I try to include the OpenCV libs

            Ex: #include <opencv2/opencv.hpp>

            And its not found

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 27 Jul 2016, 21:25 last edited by
              #6

              Shouldn't that rather be INCLUDEPATH += /usr/local/include/ ?

              IIRC, the opencv and opencv2 folder are in the same directory.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • O Offline
                O Offline
                OliveiraNT
                wrote on 28 Jul 2016, 18:31 last edited by
                #7

                When I try this I can include the libs but in build I receive this errors
                this erros:
                :-1: error: error: cannot find -lopencv_core
                :-1: error: error: cannot find -lopencv_imgcodecs
                :-1: error: error: cannot find -lopencv_highgui
                :-1: error: collect2: error: ld returned 1 exit status

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 28 Jul 2016, 20:35 last edited by
                  #8

                  What are the exact name of the libraries you have there ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  1
                  • O Offline
                    O Offline
                    OliveiraNT
                    wrote on 29 Jul 2016, 21:00 last edited by
                    #9

                    In the usr/local/lib folder -> libopencv_core.so, libopencv_highgui.so, libopencv_imgcodecs.so;

                    B 1 Reply Last reply 31 Jul 2016, 15:38
                    0
                    • S Offline
                      S Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 29 Jul 2016, 21:14 last edited by
                      #10

                      No version number ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      1
                      • O OliveiraNT
                        29 Jul 2016, 21:00

                        In the usr/local/lib folder -> libopencv_core.so, libopencv_highgui.so, libopencv_imgcodecs.so;

                        B Offline
                        B Offline
                        benlau
                        Qt Champions 2016
                        wrote on 31 Jul 2016, 15:38 last edited by
                        #11

                        @OliveiraNT said:

                        In the usr/local/lib folder -> libopencv_core.so, libopencv_highgui.so, libopencv_imgcodecs.so;

                        Are you really using opencv for Android? The prebuilt package should only contains .a file for the library above.

                        1 Reply Last reply
                        2
                        • O Offline
                          O Offline
                          OliveiraNT
                          wrote on 1 Aug 2016, 19:48 last edited by
                          #12

                          @benlau and @SGaist tanks for the help, I didn't know there is an openCV just for android.
                          I solved my problem adding the openCV sdk for android at my project with this:

                          TEMPLATE = app
                          
                          QT += qml quick
                          CONFIG += c++11
                          
                          SOURCES += main.cpp \
                              processaimagem.cpp \
                              provedorimagem.cpp
                          
                          INCLUDEPATH += /home/gpca/Qt/OpenCV-android-sdk/sdk/native/jni/include
                          OPENCV3RDPARTYLIBS = /home/gpca/Qt/OpenCV-android-sdk/sdk/native/3rdparty/libs/armeabi-v7a
                          OPENCVNATIVELIBS = /home/gpca/Qt/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a
                          LIBS += $$OPENCV3RDPARTYLIBS/liblibtiff.a
                          $$OPENCV3RDPARTYLIBS/liblibjpeg.a
                          $$OPENCV3RDPARTYLIBS/liblibjasper.a
                          $$OPENCV3RDPARTYLIBS/liblibpng.a
                          $$OPENCV3RDPARTYLIBS/libtbb.a
                          $$OPENCV3RDPARTYLIBS/libIlmImf.a
                          LIBS += $$OPENCVNATIVELIBS/libopencv_core.a
                          $$OPENCVNATIVELIBS/libopencv_androidcamera.a
                          $$OPENCVNATIVELIBS/libopencv_flann.a
                          $$OPENCVNATIVELIBS/libopencv_imgproc.a
                          $$OPENCVNATIVELIBS/libopencv_highgui.a
                          $$OPENCVNATIVELIBS/libopencv_features2d.a
                          $$OPENCVNATIVELIBS/libopencv_calib3d.a
                          $$OPENCVNATIVELIBS/libopencv_ml.a
                          $$OPENCVNATIVELIBS/libopencv_objdetect.a
                          $$OPENCVNATIVELIBS/libopencv_photo.a
                          $$OPENCVNATIVELIBS/libopencv_stitching.a
                          $$OPENCVNATIVELIBS/libopencv_superres.a
                          $$OPENCVNATIVELIBS/libopencv_ts.a
                          $$OPENCVNATIVELIBS/libopencv_video.a
                          $$OPENCVNATIVELIBS/libopencv_videostab.a
                          $$OPENCVNATIVELIBS/libopencv_java.so
                          
                          ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android-sources
                          
                          RESOURCES += qml.qrc
                          
                          
                          # Additional import path used to resolve QML modules in Qt Creator's code model
                          QML_IMPORT_PATH =
                          
                          # Default rules for deployment.
                          include(deployment.pri)
                          
                          DISTFILES += \
                              android/AndroidManifest.xml \
                              android/gradle/wrapper/gradle-wrapper.jar \
                              android/gradlew \
                              android/res/values/libs.xml \
                              android/build.gradle \
                              android/gradle/wrapper/gradle-wrapper.properties \
                              android/gradlew.bat
                          
                          ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
                          
                          HEADERS += \
                              processaimagem.h \
                              provedorimagem.h
                          
                          

                          Again, thank you both for the help.

                          1 Reply Last reply
                          0

                          1/12

                          25 Jul 2016, 19:21

                          • Login

                          • Login or register to search.
                          1 out of 12
                          • First post
                            1/12
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved