Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Errors: undefined reference to cv::VideoCapture::VideoCapture()
Forum Updated to NodeBB v4.3 + New Features

Errors: undefined reference to cv::VideoCapture::VideoCapture()

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
25 Posts 6 Posters 4.0k Views 2 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 Arev

    @Pl45m4
    Oh, I download opencv build for x86 and errors fixed
    But now my program doesn't open, I think the problem is in this line

    static cv::VideoCapture cap;
    
    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #12

    @Arev said in Errors: undefined reference to cv::VideoCapture::VideoCapture():

    But now my program doesn't open

    Then use debugger...

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

    A 1 Reply Last reply
    0
    • jsulmJ jsulm

      @Arev said in Errors: undefined reference to cv::VideoCapture::VideoCapture():

      But now my program doesn't open

      Then use debugger...

      A Offline
      A Offline
      Arev
      wrote on last edited by
      #13

      @jsulm

      I try it and I get the error:
      Executable failed: During startup program exited with code 0xc0000135.

      jsulmJ 1 Reply Last reply
      0
      • A Arev

        @Pl45m4
        Oh, I download opencv build for x86 and errors fixed
        But now my program doesn't open, I think the problem is in this line

        static cv::VideoCapture cap;
        
        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #14

        @Arev said in Errors: undefined reference to cv::VideoCapture::VideoCapture():

        static cv::VideoCapture cap

        Does it work without this line?
        Why is cap static?

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

        A 1 Reply Last reply
        0
        • jsulmJ jsulm

          @Arev said in Errors: undefined reference to cv::VideoCapture::VideoCapture():

          static cv::VideoCapture cap

          Does it work without this line?
          Why is cap static?

          A Offline
          A Offline
          Arev
          wrote on last edited by
          #15

          @jsulm

          cv::VideoCapture:
          

          This is a class from the OpenCV library used for capturing video from camera devices or video files. It provides methods to open, read, and manage video streams.
          By declaring cap as static, it's accessible across all instances of the class, and there will be only one instance of it throughout the program execution.

          jsulmJ 1 Reply Last reply
          0
          • A Arev

            @jsulm

            cv::VideoCapture:
            

            This is a class from the OpenCV library used for capturing video from camera devices or video files. It provides methods to open, read, and manage video streams.
            By declaring cap as static, it's accessible across all instances of the class, and there will be only one instance of it throughout the program execution.

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #16

            @Arev I did not ask what it is, I asked whether your app starts if this line is not there.

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

            A 1 Reply Last reply
            0
            • jsulmJ jsulm

              @Arev I did not ask what it is, I asked whether your app starts if this line is not there.

              A Offline
              A Offline
              Arev
              wrote on last edited by
              #17

              @jsulm

              Oh sorry, I created another test app and added that line that nothing in the app depended on and it didn't work and didn't cause any problems, but without that line the app works.

              1 Reply Last reply
              0
              • A Arev

                @jsulm

                I try it and I get the error:
                Executable failed: During startup program exited with code 0xc0000135.

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #18

                @Arev said in Errors: undefined reference to cv::VideoCapture::VideoCapture():

                0xc0000135

                This error code means: STATUS_DLL_NOT_FOUND
                Looks like the cv libs are not found when starting your app. How do you start it? From QtCreator?

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

                A 1 Reply Last reply
                1
                • jsulmJ jsulm

                  @Arev said in Errors: undefined reference to cv::VideoCapture::VideoCapture():

                  0xc0000135

                  This error code means: STATUS_DLL_NOT_FOUND
                  Looks like the cv libs are not found when starting your app. How do you start it? From QtCreator?

                  A Offline
                  A Offline
                  Arev
                  wrote on last edited by
                  #19

                  @jsulm

                  I can share code
                  This is my .pro

                  QT += quick
                  
                  CONFIG += c++11
                  QT_DISABLE_DEPRECATED_BEFORE=0x060000  
                  
                  SOURCES += \
                          main.cpp \
                          opencvimageprovider.cpp \
                          videostreamer.cpp
                  
                  RESOURCES += qml.qrc
                  
                  QML_IMPORT_PATH =
                  
                  QML_DESIGNER_IMPORT_PATH =
                  
                  qnx: target.path = /tmp/$${TARGET}/bin
                  else: unix:!android: target.path = /opt/$${TARGET}/bin
                  !isEmpty(target.path): INSTALLS += target
                  
                  HEADERS += \
                      opencvimageprovider.h \
                      videostreamer.h \
                  
                  win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/ -llibopencv_videoio450.dll
                  win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_calib3d450.dll
                  win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_core450.dll
                  win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_dnn450.dll
                  win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_features2d450.dll
                  win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_flann450.dll
                  win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_gapi450.dll
                  win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_highgui450.dll
                  win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_imgcodecs450.dll
                  win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_imgproc450.dll
                  win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_ml450.dll
                  win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_objdetect450.dll
                  win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_stitching450.dll
                  win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_photo450.dll
                  win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_video450.dll
                  win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_videoio450.dll
                  
                  INCLUDEPATH += $$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/include
                  DEPENDPATH += $$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/include
                  
                  win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/ -llibopencv_core450.dll
                  
                  INCLUDEPATH += $$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/include
                  DEPENDPATH += $$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/include
                  
                  
                  

                  Main.cpp

                  #include <QGuiApplication>
                  #include <QQmlApplicationEngine>
                  #include "opencvimageprovider.h"
                  #include "videostreamer.h"
                  #include <QQmlContext>
                  
                  int main(int argc, char *argv[])
                  {
                      QGuiApplication app(argc, argv);
                  
                      QQmlApplicationEngine engine;
                  
                      qRegisterMetaType<cv::Mat>("cv::Mat");
                  
                      VideoStreamer videoStreamer;
                  
                      OpencvImageProvider *liveImageProvider(new OpencvImageProvider);
                  
                      engine.rootContext()->setContextProperty("VideoStreamer",&videoStreamer);
                      engine.rootContext()->setContextProperty("liveImageProvider",liveImageProvider);
                  
                      engine.addImageProvider("live",liveImageProvider);
                  
                      const QUrl url(QStringLiteral("qrc:/main.qml"));
                  
                      engine.load(url);
                  
                      QObject::connect(&videoStreamer,&VideoStreamer::newImage,liveImageProvider,&OpencvImageProvider::updateImage);
                  
                      return app.exec();
                  }
                  

                  VideoStreamer.h

                  #ifndef VIDEOSTREAMER_H
                  #define VIDEOSTREAMER_H
                  
                  #include <QObject>
                  #include <QTimer>
                  #include <OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/include/opencv2/opencv.hpp>
                  #include <QImage>
                  #include <iostream>
                  #include <QThread>
                  
                  
                  static cv::VideoCapture cap;
                  
                  
                  class VideoStreamer: public QObject
                  {
                      Q_OBJECT
                  public:
                      VideoStreamer();
                      ~VideoStreamer();
                  
                  public:
                      void streamVideo();
                      QThread* threadStreamer = new QThread();
                      void catchFrame(cv::Mat emittedFrame);
                  
                  public slots:
                      void openVideoCamera(QString path);
                  
                      void streamerThreadSlot();
                  
                  private:
                  
                      cv::Mat frame;
                      QTimer tUpdate;
                  
                  signals:
                      void newImage(QImage &);
                  
                      void emitThreadImage(cv::Mat frameThread);
                  };
                  
                  #endif // VIDEOSTREAMER_H
                  
                  

                  VideoStreamer.cpp

                  #include "videostreamer.h"
                  
                  VideoStreamer::VideoStreamer()
                  {
                      connect(&tUpdate,&QTimer::timeout,this,&VideoStreamer::streamVideo);
                  
                  }
                  
                  VideoStreamer::~VideoStreamer()
                  {
                      cap.release();
                      tUpdate.stop();
                      threadStreamer->requestInterruption();
                  }
                  
                  void VideoStreamer::streamVideo()
                  {
                  
                      if(frame.data)
                      {
                          QImage img = QImage(frame.data,frame.cols,frame.rows,QImage::Format_RGB888).rgbSwapped();
                          emit newImage(img);
                      }
                  }
                  
                  void VideoStreamer::catchFrame(cv::Mat emittedFrame)
                  {
                      frame = emittedFrame;
                  }
                  
                  void VideoStreamer::openVideoCamera(QString path)
                  {
                      if(path.length() == 1)
                      cap.open(path.toInt());
                      else
                      cap.open(path.toStdString());
                  
                      VideoStreamer* worker = new VideoStreamer();
                      worker->moveToThread(threadStreamer);
                      QObject::connect(threadStreamer,SIGNAL(started()),worker,SLOT(streamerThreadSlot()));
                      QObject::connect(worker,&VideoStreamer::emitThreadImage,this,&VideoStreamer::catchFrame);
                      threadStreamer->start();
                  
                      double fps = cap.get(cv::CAP_PROP_FPS);
                      tUpdate.start(1000/fps);
                  }
                  
                  void VideoStreamer::streamerThreadSlot()
                  {
                      cv::Mat tempFrame;
                  
                      while (1) {
                          cap>>tempFrame;
                          if(tempFrame.data)
                              emit emitThreadImage(tempFrame);
                  
                          if(QThread::currentThread()->isInterruptionRequested())
                          {
                              cap.release();
                              return;
                          }
                  
                      }
                  }
                  
                  

                  OpencvImageProvider.h

                  #ifndef OPENCVIMAGEPROVIDER_H
                  #define OPENCVIMAGEPROVIDER_H
                  
                  
                  #include <QObject>
                  #include <QImage>
                  #include <QQuickImageProvider>
                  
                  class OpencvImageProvider : public QObject, public QQuickImageProvider
                  {
                      Q_OBJECT
                  public:
                      OpencvImageProvider(QObject *parent = nullptr);
                  
                      QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) override;
                  
                  public slots:
                      void updateImage(const QImage &image);
                  
                  signals:
                      void imageChanged();
                  
                  private:
                      QImage image;
                  };
                  
                  #endif // OPENCVIMAGEPROVIDER_H
                  

                  OpencvImageProvider.cpp

                  #include "opencvimageprovider.h"
                  
                  OpencvImageProvider::OpencvImageProvider(QObject *parent) : QObject(parent), QQuickImageProvider(QQuickImageProvider::Image)
                  {
                      image = QImage(200,200,QImage::Format_RGB32);
                      image.fill(QColor("black"));
                  }
                  
                  QImage OpencvImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
                  {
                      Q_UNUSED(id);
                  
                      if(size){
                          *size = image.size();
                      }
                  
                      if(requestedSize.width() > 0 && requestedSize.height() > 0) {
                          image = image.scaled(requestedSize.width(), requestedSize.height(), Qt::KeepAspectRatio);
                      }
                      return image;
                  }
                  
                  void OpencvImageProvider::updateImage(const QImage &image)
                  {
                      if(!image.isNull() && this->image != image) {
                          this->image = image;
                          emit imageChanged();
                      }
                  }
                  
                  
                  jsulmJ 1 Reply Last reply
                  0
                  • A Arev

                    @jsulm

                    I can share code
                    This is my .pro

                    QT += quick
                    
                    CONFIG += c++11
                    QT_DISABLE_DEPRECATED_BEFORE=0x060000  
                    
                    SOURCES += \
                            main.cpp \
                            opencvimageprovider.cpp \
                            videostreamer.cpp
                    
                    RESOURCES += qml.qrc
                    
                    QML_IMPORT_PATH =
                    
                    QML_DESIGNER_IMPORT_PATH =
                    
                    qnx: target.path = /tmp/$${TARGET}/bin
                    else: unix:!android: target.path = /opt/$${TARGET}/bin
                    !isEmpty(target.path): INSTALLS += target
                    
                    HEADERS += \
                        opencvimageprovider.h \
                        videostreamer.h \
                    
                    win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/ -llibopencv_videoio450.dll
                    win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_calib3d450.dll
                    win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_core450.dll
                    win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_dnn450.dll
                    win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_features2d450.dll
                    win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_flann450.dll
                    win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_gapi450.dll
                    win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_highgui450.dll
                    win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_imgcodecs450.dll
                    win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_imgproc450.dll
                    win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_ml450.dll
                    win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_objdetect450.dll
                    win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_stitching450.dll
                    win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_photo450.dll
                    win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_video450.dll
                    win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/-llibopencv_videoio450.dll
                    
                    INCLUDEPATH += $$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/include
                    DEPENDPATH += $$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/include
                    
                    win32: LIBS += -L$$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/x64/mingw/lib/ -llibopencv_core450.dll
                    
                    INCLUDEPATH += $$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/include
                    DEPENDPATH += $$PWD/OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/include
                    
                    
                    

                    Main.cpp

                    #include <QGuiApplication>
                    #include <QQmlApplicationEngine>
                    #include "opencvimageprovider.h"
                    #include "videostreamer.h"
                    #include <QQmlContext>
                    
                    int main(int argc, char *argv[])
                    {
                        QGuiApplication app(argc, argv);
                    
                        QQmlApplicationEngine engine;
                    
                        qRegisterMetaType<cv::Mat>("cv::Mat");
                    
                        VideoStreamer videoStreamer;
                    
                        OpencvImageProvider *liveImageProvider(new OpencvImageProvider);
                    
                        engine.rootContext()->setContextProperty("VideoStreamer",&videoStreamer);
                        engine.rootContext()->setContextProperty("liveImageProvider",liveImageProvider);
                    
                        engine.addImageProvider("live",liveImageProvider);
                    
                        const QUrl url(QStringLiteral("qrc:/main.qml"));
                    
                        engine.load(url);
                    
                        QObject::connect(&videoStreamer,&VideoStreamer::newImage,liveImageProvider,&OpencvImageProvider::updateImage);
                    
                        return app.exec();
                    }
                    

                    VideoStreamer.h

                    #ifndef VIDEOSTREAMER_H
                    #define VIDEOSTREAMER_H
                    
                    #include <QObject>
                    #include <QTimer>
                    #include <OpenCV-MinGW-Build-OpenCV-4.5.0-with-contrib/include/opencv2/opencv.hpp>
                    #include <QImage>
                    #include <iostream>
                    #include <QThread>
                    
                    
                    static cv::VideoCapture cap;
                    
                    
                    class VideoStreamer: public QObject
                    {
                        Q_OBJECT
                    public:
                        VideoStreamer();
                        ~VideoStreamer();
                    
                    public:
                        void streamVideo();
                        QThread* threadStreamer = new QThread();
                        void catchFrame(cv::Mat emittedFrame);
                    
                    public slots:
                        void openVideoCamera(QString path);
                    
                        void streamerThreadSlot();
                    
                    private:
                    
                        cv::Mat frame;
                        QTimer tUpdate;
                    
                    signals:
                        void newImage(QImage &);
                    
                        void emitThreadImage(cv::Mat frameThread);
                    };
                    
                    #endif // VIDEOSTREAMER_H
                    
                    

                    VideoStreamer.cpp

                    #include "videostreamer.h"
                    
                    VideoStreamer::VideoStreamer()
                    {
                        connect(&tUpdate,&QTimer::timeout,this,&VideoStreamer::streamVideo);
                    
                    }
                    
                    VideoStreamer::~VideoStreamer()
                    {
                        cap.release();
                        tUpdate.stop();
                        threadStreamer->requestInterruption();
                    }
                    
                    void VideoStreamer::streamVideo()
                    {
                    
                        if(frame.data)
                        {
                            QImage img = QImage(frame.data,frame.cols,frame.rows,QImage::Format_RGB888).rgbSwapped();
                            emit newImage(img);
                        }
                    }
                    
                    void VideoStreamer::catchFrame(cv::Mat emittedFrame)
                    {
                        frame = emittedFrame;
                    }
                    
                    void VideoStreamer::openVideoCamera(QString path)
                    {
                        if(path.length() == 1)
                        cap.open(path.toInt());
                        else
                        cap.open(path.toStdString());
                    
                        VideoStreamer* worker = new VideoStreamer();
                        worker->moveToThread(threadStreamer);
                        QObject::connect(threadStreamer,SIGNAL(started()),worker,SLOT(streamerThreadSlot()));
                        QObject::connect(worker,&VideoStreamer::emitThreadImage,this,&VideoStreamer::catchFrame);
                        threadStreamer->start();
                    
                        double fps = cap.get(cv::CAP_PROP_FPS);
                        tUpdate.start(1000/fps);
                    }
                    
                    void VideoStreamer::streamerThreadSlot()
                    {
                        cv::Mat tempFrame;
                    
                        while (1) {
                            cap>>tempFrame;
                            if(tempFrame.data)
                                emit emitThreadImage(tempFrame);
                    
                            if(QThread::currentThread()->isInterruptionRequested())
                            {
                                cap.release();
                                return;
                            }
                    
                        }
                    }
                    
                    

                    OpencvImageProvider.h

                    #ifndef OPENCVIMAGEPROVIDER_H
                    #define OPENCVIMAGEPROVIDER_H
                    
                    
                    #include <QObject>
                    #include <QImage>
                    #include <QQuickImageProvider>
                    
                    class OpencvImageProvider : public QObject, public QQuickImageProvider
                    {
                        Q_OBJECT
                    public:
                        OpencvImageProvider(QObject *parent = nullptr);
                    
                        QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) override;
                    
                    public slots:
                        void updateImage(const QImage &image);
                    
                    signals:
                        void imageChanged();
                    
                    private:
                        QImage image;
                    };
                    
                    #endif // OPENCVIMAGEPROVIDER_H
                    

                    OpencvImageProvider.cpp

                    #include "opencvimageprovider.h"
                    
                    OpencvImageProvider::OpencvImageProvider(QObject *parent) : QObject(parent), QQuickImageProvider(QQuickImageProvider::Image)
                    {
                        image = QImage(200,200,QImage::Format_RGB32);
                        image.fill(QColor("black"));
                    }
                    
                    QImage OpencvImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
                    {
                        Q_UNUSED(id);
                    
                        if(size){
                            *size = image.size();
                        }
                    
                        if(requestedSize.width() > 0 && requestedSize.height() > 0) {
                            image = image.scaled(requestedSize.width(), requestedSize.height(), Qt::KeepAspectRatio);
                        }
                        return image;
                    }
                    
                    void OpencvImageProvider::updateImage(const QImage &image)
                    {
                        if(!image.isNull() && this->image != image) {
                            this->image = image;
                            emit imageChanged();
                        }
                    }
                    
                    
                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #20

                    @Arev You did not answer my question

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

                    A 2 Replies Last reply
                    0
                    • jsulmJ jsulm

                      @Arev You did not answer my question

                      A Offline
                      A Offline
                      Arev
                      wrote on last edited by
                      #21

                      @jsulm
                      Yes, from Qt creator

                      1 Reply Last reply
                      0
                      • jsulmJ jsulm

                        @Arev You did not answer my question

                        A Offline
                        A Offline
                        Arev
                        wrote on last edited by
                        #22

                        @jsulm

                        In the .pro file I have not added these two lines

                        CONFIG += link_pkgconfig
                        PKGCONFIG += opencv4
                        

                        could this be the reason?
                        And after adding I get this problem:

                        opencv4 development package not found

                        SGaistS 1 Reply Last reply
                        0
                        • A Arev

                          @jsulm

                          In the .pro file I have not added these two lines

                          CONFIG += link_pkgconfig
                          PKGCONFIG += opencv4
                          

                          could this be the reason?
                          And after adding I get this problem:

                          opencv4 development package not found

                          SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #23

                          @Arev hi,

                          Are you sure about the pkgconfig package name ? If so, where is its .pc file located ?

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

                          A 1 Reply Last reply
                          0
                          • SGaistS SGaist

                            @Arev hi,

                            Are you sure about the pkgconfig package name ? If so, where is its .pc file located ?

                            A Offline
                            A Offline
                            Arev
                            wrote on last edited by
                            #24

                            @SGaist said in Errors: undefined reference to cv::VideoCapture::VideoCapture():

                            .pc

                            what is .pc file (
                            I do not have that file, where can I get

                            SGaistS 1 Reply Last reply
                            0
                            • A Arev

                              @SGaist said in Errors: undefined reference to cv::VideoCapture::VideoCapture():

                              .pc

                              what is .pc file (
                              I do not have that file, where can I get

                              SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #25

                              @Arev it's the pkgconfig configuration file. Each library / framework can provide it (or you can create your own).

                              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

                              • Login

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