Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Error first OPENCV project on Raspberry Pi 2
Forum Updated to NodeBB v4.3 + New Features

Error first OPENCV project on Raspberry Pi 2

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 818 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.
  • M Offline
    M Offline
    Miguel Lopez
    wrote on last edited by
    #1

    Hello.

    I'm trying to run Opencv on raspberry and i can't... In Windows, I work with Qt and OpenCv without problems, but in Raspberry appears an error with all funtions:

    My code is:

    temporal.pro:

       QT       += core gui
    
       greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
       TARGET = temporal
       TEMPLATE = app
    
        SOURCES += main.cpp\
        mainwindow.cpp
    
        HEADERS  += mainwindow.h
    
        FORMS    += mainwindow.ui
    
        INCLUDEPATH +=/usr/local/include
        LIBS += -L/usr/local/lib -lopencv_core -lopencv_imgcodecs -lopencv_highgui
    

    mainwindow.h:

        #ifndef MAINWINDOW_H
        #define MAINWINDOW_H
        #include <opencv2/core/core.hpp>
        #include <opencv2/highgui/highgui.hpp>
        #include <opencv2/imgproc/imgproc.hpp>
        #include <QMainWindow>
        #include <iostream>
        #include <stdio.h>
        #include <stdlib.h>
    
        namespace Ui {
        class MainWindow;
        }
    
        class MainWindow : public QMainWindow
        {
            Q_OBJECT
    
        public:
            explicit MainWindow(QWidget *parent = 0);
            ~MainWindow();
    
        private slots:
            void on_pushButton_clicked();
    
        private:
            Ui::MainWindow *ui;
        };
    
        #endif // MAINWINDOW_H
    

    main.cpp:

        #include "mainwindow.h"
        #include <QApplication>
    
        int main(int argc, char *argv[])
        {
            QApplication a(argc, argv);
            MainWindow w;
            w.show();
        }
    

    mainwindow.cpp:

        #include "mainwindow.h"
        #include "ui_mainwindow.h"
    
        #include <opencv2/highgui/highgui.hpp>
    
        using namespace cv;
    
        MainWindow::MainWindow(QWidget *parent) :
            QMainWindow(parent),
            ui(new Ui::MainWindow)
        {
            ui->setupUi(this);
        }
    
        MainWindow::~MainWindow()
        {
            delete ui;
        }
    
        void MainWindow::on_pushButton_clicked()
        {
            Mat img = imread("/home/pi/test.png",1);
        }
    

    I make test and the problem appears when i write the function, in this case, imread. And the error is:

    mainwindow.o: undefined reference to symbol '_ZN2cv6String10deallocateEv'
    error adding symbols: DSO missing from command line
    collect2: error: Id returned 1 exit status

    Any idea??

    Many thanks!!!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Are you building directly on the Pi2 ?

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

      M 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Are you building directly on the Pi2 ?

        M Offline
        M Offline
        Miguel Lopez
        wrote on last edited by
        #3

        @SGaist Yes, I make this project on Qt in Raspberry. I installed opencv following this video: https://youtu.be/rEaQqZ7VM70

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Looks like for some reason there's a symbol from opencv_core that is not found. Can you try to build a basic main.cpp only using OpenCV ?

          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