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. Issues with Building OpenCV for Android using Qt 6.4.2 on Windows 10

Issues with Building OpenCV for Android using Qt 6.4.2 on Windows 10

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
13 Posts 2 Posters 513 Views
  • 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.
  • K Offline
    K Offline
    Kaguro
    wrote on 24 Mar 2025, 08:15 last edited by
    #1

    Hi Guys!

    I'm trying to build and use OpenCV for Android in my Qt 6.4.2 project on Windows 10, but I'm running into some issues.

    Here’s what I’ve done so far:

    I added OpenCV in my project (pro file) like this:

    INCLUDEPATH += F:/Asztal/VP/OpenCV-android-sdk/sdk/native/jni/include/
    
    LIBS += \
            -L"F:/Asztal/VP/OpenCV-android-sdk/sdk/native/3rdparty/libs/armeabi-v7a/" \
            -L"F:/Asztal/VP/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/" \
            -L"F:/Asztal/VP/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/" \
            -lopencv_core \
            -lopencv_highgui \
            -lopencv_imgproc \
            -lopencv_imgcodecs \
            -lopencv_features2d \
            -lopencv_calib3d
    
    

    I attempted to use OpenCV functions, like this:

    #include <opencv2/opencv.hpp>
    cv::Mat QImageToCvMat(const QImage &image) {
        return cv::Mat(image.height(), image.width(), CV_8UC4,
                       (void*)image.constBits(), image.bytesPerLine()).clone();
    }
    
    QImage CvMatToQImage(const cv::Mat &mat) {
        return QImage(mat.data, mat.cols, mat.rows, mat.step, QImage::Format_RGBA8888).copy();
    }
    
    QImage upscaleWithOpenCV(const QImage &image, int newWidth, int newHeight) {
        cv::Mat mat = QImageToCvMat(image);
        cv::Mat resizedMat;
        cv::resize(mat, resizedMat, cv::Size(newWidth, newHeight), 0, 0, cv::INTER_LANCZOS4);
        return CvMatToQImage(resizedMat);
    }
    
    //using:
    QLabel *lajos = new QLabel();
    QImage betterScaledImage = upscaleWithOpenCV(preview, this->width(), this->height());
    lajos->setPixmap(QPixmap::fromImage(betterScaledImage));
    lajos->show();
    

    The include is correct because, I didnt get error then. But When I try to rebuild I get these errors:
    2025-03-24_09h09_15.png
    2025-03-24_09h10_24.png
    I’ve tried different approaches, but I haven’t been able to resolve the issue. Has anyone successfully built OpenCV for Android using Qt on Windows? Any advice or guidance would be greatly appreciated!

    Thanks in advance!

    J K 2 Replies Last reply 24 Mar 2025, 08:27
    0
    • K Kaguro
      24 Mar 2025, 08:15

      Hi Guys!

      I'm trying to build and use OpenCV for Android in my Qt 6.4.2 project on Windows 10, but I'm running into some issues.

      Here’s what I’ve done so far:

      I added OpenCV in my project (pro file) like this:

      INCLUDEPATH += F:/Asztal/VP/OpenCV-android-sdk/sdk/native/jni/include/
      
      LIBS += \
              -L"F:/Asztal/VP/OpenCV-android-sdk/sdk/native/3rdparty/libs/armeabi-v7a/" \
              -L"F:/Asztal/VP/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/" \
              -L"F:/Asztal/VP/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/" \
              -lopencv_core \
              -lopencv_highgui \
              -lopencv_imgproc \
              -lopencv_imgcodecs \
              -lopencv_features2d \
              -lopencv_calib3d
      
      

      I attempted to use OpenCV functions, like this:

      #include <opencv2/opencv.hpp>
      cv::Mat QImageToCvMat(const QImage &image) {
          return cv::Mat(image.height(), image.width(), CV_8UC4,
                         (void*)image.constBits(), image.bytesPerLine()).clone();
      }
      
      QImage CvMatToQImage(const cv::Mat &mat) {
          return QImage(mat.data, mat.cols, mat.rows, mat.step, QImage::Format_RGBA8888).copy();
      }
      
      QImage upscaleWithOpenCV(const QImage &image, int newWidth, int newHeight) {
          cv::Mat mat = QImageToCvMat(image);
          cv::Mat resizedMat;
          cv::resize(mat, resizedMat, cv::Size(newWidth, newHeight), 0, 0, cv::INTER_LANCZOS4);
          return CvMatToQImage(resizedMat);
      }
      
      //using:
      QLabel *lajos = new QLabel();
      QImage betterScaledImage = upscaleWithOpenCV(preview, this->width(), this->height());
      lajos->setPixmap(QPixmap::fromImage(betterScaledImage));
      lajos->show();
      

      The include is correct because, I didnt get error then. But When I try to rebuild I get these errors:
      2025-03-24_09h09_15.png
      2025-03-24_09h10_24.png
      I’ve tried different approaches, but I haven’t been able to resolve the issue. Has anyone successfully built OpenCV for Android using Qt on Windows? Any advice or guidance would be greatly appreciated!

      Thanks in advance!

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 24 Mar 2025, 08:27 last edited by
      #2

      @Kaguro Please post errors as text, not picture.
      You should look for the very first error.
      Also check to which libraries the symbols belong which are not found.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      K 1 Reply Last reply 24 Mar 2025, 10:44
      0
      • J jsulm
        24 Mar 2025, 08:27

        @Kaguro Please post errors as text, not picture.
        You should look for the very first error.
        Also check to which libraries the symbols belong which are not found.

        K Offline
        K Offline
        Kaguro
        wrote on 24 Mar 2025, 10:44 last edited by Kaguro
        #3

        @jsulm okay sorry these errors kinda same:

        ld: error: undefined symbol: carotene_o4t::isSupportedConfiguration()
        >>> referenced by arithm.dispatch.cpp
        >>>               arithm.dispatch.cpp.o:(cv::hal::add8u(unsigned char const*, unsigned int, unsigned char const*, unsigned int, unsigned char*, unsigned int, int, int, void*)) in archive F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/libopencv_core.a
        >>> referenced by arithm.dispatch.cpp
        >>>               arithm.dispatch.cpp.o:(cv::hal::add8s(signed char const*, unsigned int, signed char const*, unsigned int, signed char*, unsigned int, int, int, void*)) in archive F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/libopencv_core.a
        

        (the path is a little different, because I tried some changes)

        J 1 Reply Last reply 24 Mar 2025, 11:29
        0
        • K Kaguro
          24 Mar 2025, 10:44

          @jsulm okay sorry these errors kinda same:

          ld: error: undefined symbol: carotene_o4t::isSupportedConfiguration()
          >>> referenced by arithm.dispatch.cpp
          >>>               arithm.dispatch.cpp.o:(cv::hal::add8u(unsigned char const*, unsigned int, unsigned char const*, unsigned int, unsigned char*, unsigned int, int, int, void*)) in archive F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/libopencv_core.a
          >>> referenced by arithm.dispatch.cpp
          >>>               arithm.dispatch.cpp.o:(cv::hal::add8s(signed char const*, unsigned int, signed char const*, unsigned int, signed char*, unsigned int, int, int, void*)) in archive F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/libopencv_core.a
          

          (the path is a little different, because I tried some changes)

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 24 Mar 2025, 11:29 last edited by
          #4

          @Kaguro said in Issues with Building OpenCV for Android using Qt 6.4.2 on Windows 10:

          armeabi-v7a

          I'm not sure this is the correct ABI. Check the ABI of your Android Qt installation, it is probably v8a. ABIs must match.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          K 2 Replies Last reply 24 Mar 2025, 11:39
          0
          • J jsulm
            24 Mar 2025, 11:29

            @Kaguro said in Issues with Building OpenCV for Android using Qt 6.4.2 on Windows 10:

            armeabi-v7a

            I'm not sure this is the correct ABI. Check the ABI of your Android Qt installation, it is probably v8a. ABIs must match.

            K Offline
            K Offline
            Kaguro
            wrote on 24 Mar 2025, 11:39 last edited by
            #5

            @jsulm Its armeabi-v7a I checked. I always build with this to android

            1 Reply Last reply
            0
            • J jsulm
              24 Mar 2025, 11:29

              @Kaguro said in Issues with Building OpenCV for Android using Qt 6.4.2 on Windows 10:

              armeabi-v7a

              I'm not sure this is the correct ABI. Check the ABI of your Android Qt installation, it is probably v8a. ABIs must match.

              K Offline
              K Offline
              Kaguro
              wrote on 24 Mar 2025, 11:43 last edited by Kaguro
              #6

              @jsulm I download from there:
              https://github.com/opencv/opencv/releases/tag/4.11.0
              the "opencv-4.11.0-android-sdk" And I just use it... this can be the problem?

              J 2 Replies Last reply 24 Mar 2025, 12:40
              0
              • K Kaguro
                24 Mar 2025, 11:43

                @jsulm I download from there:
                https://github.com/opencv/opencv/releases/tag/4.11.0
                the "opencv-4.11.0-android-sdk" And I just use it... this can be the problem?

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 24 Mar 2025, 12:40 last edited by
                #7

                @Kaguro Then look in the build log for linker warnings: if some libs are incompatible you will get warning.
                And as I suggested before: check which libraries provide the symbols which are not found and then check whether you link these libs.
                For example carotene_o4t::isSupportedConfiguration seems to come from libtegra_hal (see https://stackoverflow.com/questions/41665655/what-is-carotene-o4t-and-why-does-it-cause-issues-with-compiling-a-program-using).

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • K Kaguro
                  24 Mar 2025, 11:43

                  @jsulm I download from there:
                  https://github.com/opencv/opencv/releases/tag/4.11.0
                  the "opencv-4.11.0-android-sdk" And I just use it... this can be the problem?

                  J Offline
                  J Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 24 Mar 2025, 12:41 last edited by
                  #8

                  @Kaguro said in Issues with Building OpenCV for Android using Qt 6.4.2 on Windows 10:

                  this can be the problem?

                  It can if the ABIs do not match.

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  K 1 Reply Last reply 24 Mar 2025, 14:14
                  0
                  • J jsulm
                    24 Mar 2025, 12:41

                    @Kaguro said in Issues with Building OpenCV for Android using Qt 6.4.2 on Windows 10:

                    this can be the problem?

                    It can if the ABIs do not match.

                    K Offline
                    K Offline
                    Kaguro
                    wrote on 24 Mar 2025, 14:14 last edited by
                    #9

                    @jsulm
                    so I try this now:

                    LIBS += \
                            -L"F:/Asztal/VP/mew/OpenCV-android-sdk/sdk/native/3rdparty/libs/armeabi-v7a/" \
                            -L"F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/" \
                            -L"F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/" \
                            -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_core \
                            -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_dnn \
                            -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_flann \
                            -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_highgui \
                            -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_gapi \
                            -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_ml \
                            -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_objdetect \
                            -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_photo \
                            -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_imgproc \
                            -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_imgcodecs \
                            -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_features2d \
                            -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_calib3d \
                            -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_video \
                            -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_videoio \
                            -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/3rdparty/libs/armeabi-v7a -ltegra_hal \
                            -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_stitching \
                            -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/3rdparty/libs/armeabi-v7a -ltbb
                    

                    And now I got "only" 15 errors for example:
                    :-1: error: error: undefined symbol: android_getCpuFeatures
                    :-1: error: error: undefined symbol: __itt_thread_set_name_ptr__3_0
                    :-1: error: error: undefined symbol: __itt_string_handle_create_ptr__3_0
                    (etc..)

                    And it looks like this is from libopencv_core. But I already linked the libopencv_core

                    J 1 Reply Last reply 24 Mar 2025, 14:22
                    0
                    • K Kaguro
                      24 Mar 2025, 14:14

                      @jsulm
                      so I try this now:

                      LIBS += \
                              -L"F:/Asztal/VP/mew/OpenCV-android-sdk/sdk/native/3rdparty/libs/armeabi-v7a/" \
                              -L"F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/" \
                              -L"F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/" \
                              -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_core \
                              -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_dnn \
                              -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_flann \
                              -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_highgui \
                              -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_gapi \
                              -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_ml \
                              -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_objdetect \
                              -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_photo \
                              -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_imgproc \
                              -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_imgcodecs \
                              -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_features2d \
                              -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_calib3d \
                              -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_video \
                              -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_videoio \
                              -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/3rdparty/libs/armeabi-v7a -ltegra_hal \
                              -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_stitching \
                              -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/3rdparty/libs/armeabi-v7a -ltbb
                      

                      And now I got "only" 15 errors for example:
                      :-1: error: error: undefined symbol: android_getCpuFeatures
                      :-1: error: error: undefined symbol: __itt_thread_set_name_ptr__3_0
                      :-1: error: error: undefined symbol: __itt_string_handle_create_ptr__3_0
                      (etc..)

                      And it looks like this is from libopencv_core. But I already linked the libopencv_core

                      J Offline
                      J Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on 24 Mar 2025, 14:22 last edited by
                      #10

                      @Kaguro Did you check whether there are any linker warning about incompatible libraries?
                      You should also check the linker call to make sure all the libs were passed to it.

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      K 1 Reply Last reply 24 Mar 2025, 14:54
                      0
                      • J jsulm
                        24 Mar 2025, 14:22

                        @Kaguro Did you check whether there are any linker warning about incompatible libraries?
                        You should also check the linker call to make sure all the libs were passed to it.

                        K Offline
                        K Offline
                        Kaguro
                        wrote on 24 Mar 2025, 14:54 last edited by
                        #11

                        @jsulm Sorry I am really a beginner and I don't understand exactly what you would ask for.
                        I just see errors and this is the whole log what I see :

                        C:\Users\Kaguro\AppData\Local\Android\Sdk\ndk\23.1.7779620/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++ -target armv7a-linux-androideabi23 -fno-limit-debug-info -Wl,--exclude-libs,libunwind.a -Wl,-soname,libPoorMans_thatsyou_client_armeabi-v7a.so -Wl,--build-id=sha1 -Wl,--no-undefined -Wl,-z,noexecstack -shared -o libPoorMans_thatsyou_client_armeabi-v7a.so  @object_script.libPoorMans_thatsyou_client_armeabi-v7a.so   -LF:/Asztal/VP/mew/OpenCV-android-sdk/sdk/native/3rdparty/libs/armeabi-v7a/ -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/ -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/ -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a -lopencv_core -lopencv_dnn -lopencv_flann -lopencv_highgui -lopencv_gapi -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_imgproc -lopencv_imgcodecs -lopencv_features2d -lopencv_calib3d -lopencv_video -lopencv_videoio -LF:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/3rdparty/libs/armeabi-v7a -ltegra_hal -lopencv_stitching -ltbb D:/Qt/6.4.2/android_armv7/lib/libQt6MultimediaWidgets_armeabi-v7a.so D:/Qt/6.4.2/android_armv7/lib/libQt6Multimedia_armeabi-v7a.so D:/Qt/6.4.2/android_armv7/lib/libQt6Widgets_armeabi-v7a.so D:/Qt/6.4.2/android_armv7/lib/libQt6Gui_armeabi-v7a.so -lEGL D:/Qt/6.4.2/android_armv7/lib/libQt6Network_armeabi-v7a.so D:/Qt/6.4.2/android_armv7/lib/libQt6Core_armeabi-v7a.so -llog -pthread -lGLESv2   -llog -lz -lm -ldl -lc
                        ld: error: undefined symbol: android_getCpuFeatures
                        >>> referenced by system.cpp
                        >>>               system.cpp.o:(cv::HWFeatures::initialize()) in archive F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/libopencv_core.a
                        
                        ld: error: undefined symbol: __itt_thread_set_name_ptr__3_0
                        >>> referenced by system.cpp
                        >>>               system.cpp.o:(cv::TLSData<cv::(anonymous namespace)::ThreadID>::createDataInstance() const) in archive F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/libopencv_core.a
                        
                        ld: error: undefined symbol: __itt_string_handle_create_ptr__3_0
                        >>> referenced by trace.cpp
                        >>>               trace.cpp.o:(cv::utils::trace::details::Region::LocationExtraData::LocationExtraData(cv::utils::trace::details::Region::LocationStaticStorage const&)) in archive F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/libopencv_core.a
                        >>> referenced by trace.cpp
                        >>>               trace.cpp.o:(cv::utils::trace::details::Region::Impl::leaveRegion(cv::utils::trace::details::TraceManagerThreadLocal&)) in archive F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/libopencv_core.a
                        >>> referenced by trace.cpp
                        >>>               trace.cpp.o:(cv::utils::trace::details::TraceManager::TraceManager()) in archive F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/libopencv_core.a
                        >>> referenced 1 more times
                        
                        ld: error: undefined symbol: __itt_api_version_ptr__3_0
                        >>> referenced by trace.cpp
                        >>>               trace.cpp.o:(cv::utils::trace::details::isITTEnabled()) in archive F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/libopencv_core.a
                        
                        ld: error: undefined symbol: __itt_domain_create_ptr__3_0
                        >>> referenced by trace.cpp
                        >>>               trace.cpp.o:(cv::utils::trace::details::isITTEnabled()) in archive F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/libopencv_core.a
                        
                        ld: error: undefined symbol: __itt_id_create_ptr__3_0
                        >>> referenced by trace.cpp
                        >>>               trace.cpp.o:(cv::utils::trace::details::Region::Impl::Impl(cv::utils::trace::details::TraceManagerThreadLocal&, cv::utils::trace::details::Region*, cv::utils::trace::details::Region&, cv::utils::trace::details::Region::LocationStaticStorage const&, long long)) in archive F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/libopencv_core.a
                        >>> referenced by trace.cpp
                        >>>               trace.cpp.o:(cv::utils::trace::details::Region::Impl::registerRegion(cv::utils::trace::details::TraceManagerThreadLocal&)) in archive F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/libopencv_core.a
                        
                        ld: error: undefined symbol: __itt_task_begin_ptr__3_0
                        >>> referenced by trace.cpp
                        >>>               trace.cpp.o:(cv::utils::trace::details::Region::Impl::enterRegion(cv::utils::trace::details::TraceManagerThreadLocal&)) in archive F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/libopencv_core.a
                        
                        ld: error: undefined symbol: __itt_id_destroy_ptr__3_0
                        >>> referenced by trace.cpp
                        >>>               trace.cpp.o:(cv::utils::trace::details::Region::Impl::~Impl()) in archive F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/libopencv_core.a
                        
                        ld: error: undefined symbol: __itt_metadata_add_ptr__3_0
                        >>> referenced by trace.cpp
                        >>>               trace.cpp.o:(cv::utils::trace::details::Region::Impl::leaveRegion(cv::utils::trace::details::TraceManagerThreadLocal&)) in archive F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/libopencv_core.a
                        >>> referenced by trace.cpp
                        >>>               trace.cpp.o:(cv::utils::trace::details::traceArg(cv::utils::trace::details::TraceArg const&, int)) in archive F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/libopencv_core.a
                        >>> referenced by trace.cpp
                        >>>               trace.cpp.o:(cv::utils::trace::details::traceArg(cv::utils::trace::details::TraceArg const&, long long)) in archive F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/libopencv_core.a
                        >>> referenced 1 more times
                        
                        ld: error: undefined symbol: __itt_task_end_ptr__3_0
                        >>> referenced by trace.cpp
                        >>>               trace.cpp.o:(cv::utils::trace::details::Region::Impl::leaveRegion(cv::utils::trace::details::TraceManagerThreadLocal&)) in archive F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/libopencv_core.a
                        
                        ld: error: undefined symbol: __itt_region_begin_ptr__3_0
                        >>> referenced by trace.cpp
                        >>>               trace.cpp.o:(cv::utils::trace::details::TraceManager::TraceManager()) in archive F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/libopencv_core.a
                        
                        ld: error: undefined symbol: __itt_region_end_ptr__3_0
                        >>> referenced by trace.cpp
                        >>>               trace.cpp.o:(cv::utils::trace::details::TraceManager::~TraceManager()) in archive F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/libopencv_core.a
                        
                        ld: error: undefined symbol: __itt_relation_add_ptr__3_0
                        >>> referenced by trace.cpp
                        >>>               trace.cpp.o:(cv::utils::trace::details::parallelForAttachNestedRegion(cv::utils::trace::details::Region const&)) in archive F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/libopencv_core.a
                        
                        ld: error: undefined symbol: __itt_metadata_str_add_ptr__3_0
                        >>> referenced by trace.cpp
                        >>>               trace.cpp.o:(cv::utils::trace::details::traceArg(cv::utils::trace::details::TraceArg const&, char const*)) in archive F:/Asztal/VP/new/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/libopencv_core.a
                        clang++: error: linker command failed with exit code 1 (use -v to see invocation)
                        make: *** [Makefile:121: libPoorMans_thatsyou_client_armeabi-v7a.so] Error 1
                        15:40:32: The process "C:\Users\Kaguro\AppData\Local\Android\Sdk\ndk\23.1.7779620\prebuilt\windows-x86_64\bin\make.exe" exited with code 2.
                        15:40:33: Error while building/deploying project PoorMans_thatsyou_client (kit: Android Qt 6.4.2 Clang armeabi-v7a)
                        15:40:33: When executing step "Make"
                        

                        The opencv and the Qt use the same armeabi-v7a.

                        1 Reply Last reply
                        0
                        • K Kaguro
                          24 Mar 2025, 08:15

                          Hi Guys!

                          I'm trying to build and use OpenCV for Android in my Qt 6.4.2 project on Windows 10, but I'm running into some issues.

                          Here’s what I’ve done so far:

                          I added OpenCV in my project (pro file) like this:

                          INCLUDEPATH += F:/Asztal/VP/OpenCV-android-sdk/sdk/native/jni/include/
                          
                          LIBS += \
                                  -L"F:/Asztal/VP/OpenCV-android-sdk/sdk/native/3rdparty/libs/armeabi-v7a/" \
                                  -L"F:/Asztal/VP/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/" \
                                  -L"F:/Asztal/VP/OpenCV-android-sdk/sdk/native/staticlibs/armeabi-v7a/" \
                                  -lopencv_core \
                                  -lopencv_highgui \
                                  -lopencv_imgproc \
                                  -lopencv_imgcodecs \
                                  -lopencv_features2d \
                                  -lopencv_calib3d
                          
                          

                          I attempted to use OpenCV functions, like this:

                          #include <opencv2/opencv.hpp>
                          cv::Mat QImageToCvMat(const QImage &image) {
                              return cv::Mat(image.height(), image.width(), CV_8UC4,
                                             (void*)image.constBits(), image.bytesPerLine()).clone();
                          }
                          
                          QImage CvMatToQImage(const cv::Mat &mat) {
                              return QImage(mat.data, mat.cols, mat.rows, mat.step, QImage::Format_RGBA8888).copy();
                          }
                          
                          QImage upscaleWithOpenCV(const QImage &image, int newWidth, int newHeight) {
                              cv::Mat mat = QImageToCvMat(image);
                              cv::Mat resizedMat;
                              cv::resize(mat, resizedMat, cv::Size(newWidth, newHeight), 0, 0, cv::INTER_LANCZOS4);
                              return CvMatToQImage(resizedMat);
                          }
                          
                          //using:
                          QLabel *lajos = new QLabel();
                          QImage betterScaledImage = upscaleWithOpenCV(preview, this->width(), this->height());
                          lajos->setPixmap(QPixmap::fromImage(betterScaledImage));
                          lajos->show();
                          

                          The include is correct because, I didnt get error then. But When I try to rebuild I get these errors:
                          2025-03-24_09h09_15.png
                          2025-03-24_09h10_24.png
                          I’ve tried different approaches, but I haven’t been able to resolve the issue. Has anyone successfully built OpenCV for Android using Qt on Windows? Any advice or guidance would be greatly appreciated!

                          Thanks in advance!

                          K Offline
                          K Offline
                          Kaguro
                          wrote on 26 Mar 2025, 08:01 last edited by
                          #12

                          Somebody tried to use OpenCV with Qt c++ android with armeabi-v7a? I am very beginner in this kind of project, so I dont know what is the most correct way to use OpenCV with Qt Android. Has anyone tried it and succeeded?

                          J 1 Reply Last reply 27 Mar 2025, 09:58
                          0
                          • K Kaguro
                            26 Mar 2025, 08:01

                            Somebody tried to use OpenCV with Qt c++ android with armeabi-v7a? I am very beginner in this kind of project, so I dont know what is the most correct way to use OpenCV with Qt Android. Has anyone tried it and succeeded?

                            J Offline
                            J Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on 27 Mar 2025, 09:58 last edited by
                            #13

                            @Kaguro Please post whole build log.

                            https://forum.qt.io/topic/113070/qt-code-of-conduct

                            1 Reply Last reply
                            0

                            5/13

                            24 Mar 2025, 11:39

                            8 unread
                            • Login

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