IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

OpenCV Discussion :

linkage d'OpenCV sur Qt creator


Sujet :

OpenCV

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre régulier
    Profil pro
    Étudiant
    Inscrit en
    Avril 2013
    Messages
    5
    Détails du profil
    Informations personnelles :
    Localisation : France, Loiret (Centre)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Avril 2013
    Messages : 5
    Par défaut linkage d'OpenCV sur Qt creator
    Bonjour tout le monde,

    J'ai un problème de linkage d'OpenCV, j'utilise les librairies static (.a), et je n'arrive pas à faire le linkage dans le fichier (.pro), est ce que quelqu'un a une idée? Je vous remercie d'avance.

    Le fichier .PRO:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    QT       += core gui
     
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
     
     
    TARGET = Test
        target.files = Test
        target.path = /home/root
    INSTALLS += target
     
    TARGET = Test
    TEMPLATE = app
     
    #INCLUDEPATH += "/usr/local/include/opencv" "/usr/local/include/opencv2"
    #LIBS +=  -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann
     
    INCLUDEPATH += "/opt/opencv2.3/include" "/opt/opencv2.3/include/opencv" "/opt/opencv2.3/include/opencv2"
    LIBS += "-L/opt/opencv2.3/lib" -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann
     
     
    SOURCES += main.cpp \
            mainwindow.cpp \
            Test2.cpp
     
    HEADERS  += mainwindow.h
     
    FORMS    += mainwindow.ui
    et voici les erreurs que ça génère, j'ai pas mis tout les erreurs car la fenêtre ne supporte pas ... :
    Code x : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    /opt/opencv2.3/lib/libopencv_highgui.a(cap.o): In function `cv::Mat::release()':
    cap.cpp:(.text._ZN2cv3Mat7releaseEv[cv::Mat::release()]+0x4c): undefined reference to `cv::Mat::deallocate()'
    /opt/opencv2.3/lib/libopencv_highgui.a(cap.o): In function `cv::VideoWriter::write(cv::Mat const&)':
    cap.cpp:(.text._ZN2cv11VideoWriter5writeERKNS_3MatE+0x10): undefined reference to `cv::Mat::operator _IplImage() const'
    /opt/opencv2.3/lib/libopencv_highgui.a(cap.o): In function `cv::Ptr<CvVideoWriter>::release()':
    cap.cpp:(.text._ZN2cv3PtrI13CvVideoWriterE7releaseEv[cv::Ptr<CvVideoWriter>::release()]+0x5c): undefined reference to `cv::fastFree(void*)'
    /opt/opencv2.3/lib/libopencv_highgui.a(cap.o): In function `cv::Ptr<CvCapture>::release()':
    cap.cpp:(.text._ZN2cv3PtrI9CvCaptureE7releaseEv[cv::Ptr<CvCapture>::release()]+0x5c): undefined reference to `cv::fastFree(void*)'
    /opt/opencv2.3/lib/libopencv_highgui.a(cap.o): In function `cv::Mat::~Mat()':
    cap.cpp:(.text._ZN2cv3MatD1Ev[cv::Mat::~Mat()]+0x54): undefined reference to `cv::fastFree(void*)'
    cap.cpp:(.text._ZN2cv3MatD1Ev[cv::Mat::~Mat()]+0x64): undefined reference to `cv::Mat::deallocate()'
    /opt/opencv2.3/lib/libopencv_highgui.a(cap.o): In function `cv::VideoCapture::read(cv::Mat&)':
    cap.cpp:(.text._ZN2cv12VideoCapture4readERNS_3MatE+0xe4): undefined reference to `cv::Mat::deallocate()'
    /opt/opencv2.3/lib/libopencv_highgui.a(cap.o): In function `cv::VideoCapture::operator>>(cv::Mat&)':
    cap.cpp:(.text._ZN2cv12VideoCapturersERNS_3MatE+0x88): undefined reference to `cv::Mat::deallocate()'
    /opt/opencv2.3/lib/libopencv_highgui.a(cap.o): In function `cv::VideoCapture::retrieve(cv::Mat&, int)':
    cap.cpp:(.text._ZN2cv12VideoCapture8retrieveERNS_3MatEi+0x4c): undefined reference to `cv::Mat::Mat(_IplImage const*, bool)'
    cap.cpp:(.text._ZN2cv12VideoCapture8retrieveERNS_3MatEi+0xd4): undefined reference to `cv::Mat::copySize(cv::Mat const&)'
    cap.cpp:(.text._ZN2cv12VideoCapture8retrieveERNS_3MatEi+0x150): undefined reference to `cv::fastFree(void*)'
    cap.cpp:(.text._ZN2cv12VideoCapture8retrieveERNS_3MatEi+0x16c): undefined reference to `cv::Mat::Mat(_IplImage const*, bool)'
    cap.cpp:(.text._ZN2cv12VideoCapture8retrieveERNS_3MatEi+0x17c): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
    cap.cpp:(.text._ZN2cv12VideoCapture8retrieveERNS_3MatEi+0x18c): undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
    cap.cpp:(.text._ZN2cv12VideoCapture8retrieveERNS_3MatEi+0x19c): undefined reference to `cv::flip(cv::_InputArray const&, cv::_OutputArray const&, int)'
    cap.cpp:(.text._ZN2cv12VideoCapture8retrieveERNS_3MatEi+0x1ec): undefined reference to `cv::fastFree(void*)'
    cap.cpp:(.text._ZN2cv12VideoCapture8retrieveERNS_3MatEi+0x238): undefined reference to `cv::Mat::deallocate()'
    loadsave.cpp:(.text._ZN2cv8imencodeERKSsRKNS_11_InputArrayERSt6vectorIhSaIhEERKS5_IiSaIiEE+0x430): undefined reference to `cv::Exception::Exception(int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
    loadsave.cpp:(.text._ZN2cv8imencodeERKSsRKNS_11_InputArrayERSt6vectorIhSaIhEERKS5_IiSaIiEE+0x438): undefined reference to `cv::error(cv::Exception const&)'
    loadsave.cpp:(.text._ZN2cv8imencodeERKSsRKNS_11_InputArrayERSt6vectorIhSaIhEERKS5_IiSaIiEE+0x440): undefined reference to `cv::Exception::~Exception()'
    loadsave.cpp:(.text._ZN2cv8imencodeERKSsRKNS_11_InputArrayERSt6vectorIhSaIhEERKS5_IiSaIiEE+0x4fc): undefined reference to `cv::Exception::Exception(int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
    ...
    collect2: ld returned 1 exit status
    make: *** [Test] Error 1
    09:37:27: Le processus "/usr/bin/make" s'est terminé avec le code 2.
    Error while building/deploying project Test (kit: BeagleboneKit)
    Lors de l'exécution de l'étape "Make"

  2. #2
    Invité de passage
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2013
    Messages
    1
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Juin 2013
    Messages : 1
    Par défaut
    Moi qui pensait que le problème venait de ma config, je vois que je ne suis pas le seul :
    -Qt5.1.0 RC1 pour Windows,
    -OpenCV for Android 2.4.5
    Quelqu'un a-t-il une solution ? Merci

  3. #3
    Membre éprouvé
    Inscrit en
    Mai 2012
    Messages
    65
    Détails du profil
    Informations forums :
    Inscription : Mai 2012
    Messages : 65
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    LIBS += "-L/opt/opencv2.3/lib" -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann
    Personnellement à la place, dans mes fichiers .pro j'écris ça et tout roule correctement :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    QMAKE_LIBS += `pkg-config opencv --libs`
    QMAKE_LIBDIR += chemin_des_libs
    Au cas où si ça ne marche toujours pas essaie de rajouter à ta variable d'environnement LD_LIBRARY le chemin vers tes libs en faisant :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    export LD_LIBRARY=/opt/opencv2.3/lib:$LD_LIBRARY
    N'oublie pas de l'écrire dans ton fichier .bashrc si tu veux que ce soit permanent.

Discussions similaires

  1. OpenCV avec Qt Creator sur ARM (Beagle bone)
    Par benyaya_benyaya dans le forum OpenCV
    Réponses: 1
    Dernier message: 28/09/2013, 00h36
  2. OpenCV sur Mac OS X (Xcode)
    Par ninours23 dans le forum OpenCV
    Réponses: 5
    Dernier message: 13/04/2011, 18h19
  3. Réponses: 0
    Dernier message: 30/07/2009, 21h35
  4. Problème d'installation de openCV sur visual C++ 6.0
    Par jp_developpeur dans le forum Visual C++
    Réponses: 3
    Dernier message: 19/11/2008, 19h02
  5. [Linkage] error LNK2019 sur la creation d'une dll
    Par drcd dans le forum Visual C++
    Réponses: 2
    Dernier message: 23/04/2007, 15h58

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo