Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Linking openCv with Qt

    Mobile and Embedded
    opencv cpp
    2
    2
    1551
    Loading More Posts
    • 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.
    • A
      Anas_Deshmukh last edited by Anas_Deshmukh

      hello everyone,
      i want to include OpenCv libraries with qt 4.8.5.

      getting error like :
      error: opencv2/core/core.hpp: No such file or directory

      i feel thankful if u help me to link this libraries properly.

      // my .pro file
      # Additional import path used to resolve QML modules in Creator's code model
      QML_IMPORT_PATH =
      
      # The .cpp file which was generated for your project. Feel free to hack it.
      SOURCES += main.cpp \
          test.cpp
      
      RESOURCES += qml.qrc
      
      # Installation path
      # target.path =
      
      # Please do not modify the following two lines. Required for deployment.
      include(qtquick1applicationviewer/qtquick1applicationviewer.pri)
      
      # Default rules for deployment.
      include(deployment.pri)
      
      
      INCLUDEPATH +=/home/anas/opencvArm/include/
      LIBS += -L/home/anas/opencvArm/lib/
      
      HEADERS += \
      
      // test.h
      #include <opencv2/core/core.hpp>
      #include <opencv2/highgui/highgui.hpp>
      #include <opencv2/contrib/contrib.hpp>
      #include <opencv2/imgproc/imgproc.hpp>
      
      #include <QtCore>
      #include <iostream>
      #include <stdio.h>
      using namespace cv;
      using namespace std;
      
      class openCV : public QObject
      {
          Q_OBJECT
      public:
      void loadImage();
      };
      ``
      
      
      /// test.cpp```
      
      void openCV::loadImage(){
      string imageName("HappyFish.jpg");
          if( argc != 2)
          {
           cout <<" Usage: display_image ImageToLoadAndDisplay" << endl;
           return -1;
          }
      
          Mat image;
          image = imread(argv[1], CV_LOAD_IMAGE_COLOR);   // Read the file
      
          if(! image.data )                              // Check for invalid input
          {
              cout <<  "Could not open or find the image" << std::endl ;
              return -1;
          }
      else std::cout << "its working\n";
      }
      

      // //// main.cpp

      #include "qtquick1applicationviewer.h"
      #include <QApplication>
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
      
          QtQuick1ApplicationViewer viewer;
          viewer.addImportPath(QLatin1String("modules"));
          viewer.setOrientation(QtQuick1ApplicationViewer::ScreenOrientationAuto);
          viewer.setMainQmlFile(QLatin1String("qrc:/main.qml"));
          viewer.showExpanded();
      
          return app.exec();
      }
      
      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        Maybe a silly question but are you sure that OpenCV is properly installed in opencvArm ?

        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 Reply Quote 0
        • First post
          Last post