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. Linking openCv with Qt

Linking openCv with Qt

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
opencvcpp
2 Posts 2 Posters 1.8k Views 1 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.
  • A Offline
    A Offline
    Anas_Deshmukh
    wrote on last edited by Anas_Deshmukh
    #1

    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
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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
      0

      • Login

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