Results 1 to 6 of 6

Thread: Pb to install opencv2.3 under Qt

  1. #1
    Join Date
    Aug 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Pb to install opencv2.3 under Qt

    Hello to all,

    As it is said in the title, I wish to install opencv2.3 under Qt creator.

    My version is OpenCV-2.3.0-win-superpack, I decompressed it and installed under the directory:

    Let be C:\Develop\Opencv\build and C:\Develop\Opencv\opencv

    I installed then the last one sdk Qt that is:
    Qt Creator 2.2.1
    Based on Qt 4.7.4 32bit and mingw4.4 (I not nothing changed)

    I already have to install opencv2.3 with codeblocks thanks to OpenCV-2.3.0-win-superpack and to MinGW-4.5.2 that I installed and then changed the tool chain in codeblocks.

    And my wish would be to make it turn under Qt who seems to me rather nice.

    I have already followed quite a lot of explanation but I do not still manage to take out there.

    I put a project console with one quite simple hand for tried:


    // main.cpp
    #include <opencv2/highgui/highgui.hpp>
    #include <opencv2/core/core.hpp>

    int main(){
    cv::Mat image = cv::imread("test.jpg");
    cv::namedWindow("My Image");
    cv::imshow("My Image", image);
    cv::waitKey(-1);
    return 0;
    }

    #.pro
    TEMPLATE = app
    QT -= gui
    TARGET = SimpleCvApp

    SOURCES += \
    main.cpp

    INCLUDEPATH += C:/Develop/Opencv/opencv/modules/core/include \
    C:/Develop/Opencv/opencv/modules/highgui/include \
    C:/Develop/Opencv/build/x86/mingw/lib
    LIBS += "C:\Develop\Opencv\build\x86\mingw\lib\libopencv_c ore230.dll.a" \
    LIBS = "C:\Develop\Opencv\build\x86\mingw\lib\libopencv_h ighgui230.dll.a"

    I tried some solution, but unsuccessfully. If somebody had a track or a tutorial.

    Thank you in advance
    Stéphane

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Pb to install opencv2.3 under Qt

    May be a coincidence, but there is similar thread about OpenCV 2.3 : link...
    Anyway, you forgot to tell us whats the problem
    LIBS += "C:\Develop\Opencv\build\x86\mingw\lib\libopen cv_c ore230.dll.a" \
    LIBS = "C:\Develop\Opencv\build\x86\mingw\lib\libopen cv_h ighgui230.dll.a"
    Surely you wanted to write LIBS += in the last line, not LIBS = , because this will ... yeah I think you know why. And dynamic linking should be done using the -l flag (LIBS += -lopencv_core230 etc).

  3. #3
    Join Date
    Aug 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Pb to install opencv2.3 under Qt

    Thank you for your answer
    The problem it is because I do not manage to make turn opencv2.3 under qt creator.
    I have to recompile opencv2.3 with mingw of Qt, thus I think that of this quoted, I am good.
    I put back my main:
    <code>
    /**
    * @file DisplayImage.cpp
    * @brief Sample code that show how to read and display an image in a OpenCV window
    * @author OpenCV team
    */

    #include <QApplication>

    #include <cv.h>
    #include <highgui.h>

    using namespace cv;

    int main(int argc, char *argv[])

    {
    QApplication app(argc, argv);

    // Mat image;
    //image = imread( argv[1], 1 );

    //if( argc != 2 || !image.data )
    // {
    // printf( "No image data \n" );
    // return -1;
    // }

    // namedWindow( "Display Image", CV_WINDOW_AUTOSIZE );
    //imshow( "Display Image", image );

    // waitKey(0);

    return app.exec();

    }
    </code>
    and my .pro
    <code>
    #.pro
    TEMPLATE = app
    QT -= gui
    TARGET = Test

    SOURCES += \
    main.cpp

    INCLUDEPATH += "C:/Develop/Opencv/Build/install/modules/core/include" \
    "C:/Develop/Opencv/Build/install/modules/highgui/include"

    LIBS += "C:\Develop\Opencv\Build\install\bin\libopencv_cal ib3d230.dll" \
    LIBS += "C:\Develop\Opencv\Build\install\bin\libopencv_con trib230.dll" \
    LIBS += "C:\Develop\Opencv\Build\install\bin\libopencv_cor e230.dll" \
    LIBS += "C:\Develop\Opencv\Build\install\bin\libopencv_fea tures2d230.dll" \
    LIBS += "C:\Develop\Opencv\Build\install\bin\libopencv_fla nn230.dll" \
    LIBS += "C:\Develop\Opencv\Build\install\bin\libopencv_gpu 230.dll" \
    LIBS += "C:\Develop\Opencv\Build\install\bin\libopencv_hig hgui230.dll" \
    LIBS += "C:\Develop\Opencv\Build\install\bin\libopencv_img proc230.dll" \
    LIBS += "C:\Develop\Opencv\Build\install\bin\libopencv_leg acy230.dll" \
    LIBS += "C:\Develop\Opencv\Build\install\bin\libopencv_ml2 30.dll" \
    LIBS += "C:\Develop\Opencv\Build\install\bin\libopencv_obj detect230.dll" \
    LIBS += "C:\Develop\Opencv\Build\install\bin\libopencv_vid eo230.dll" \
    LIBS += "C:\Develop\Opencv\Build\install\bin\opencv_ffmpeg .dll" \

    #LIBS += "C:\Develop\Opencv\Build\install\bin\libopencv_cor e230.dll" \
    #LIBS += "C:\Develop\Opencv\Build\install\bin\libopencv_hig hgui230.dll" \
    </code>

    When i shoot qmake qt say : Unescaped bachslashes are deprecated
    And when i shoot the prog : QApplication : no such file or directory
    like cv.h and highgui.h.
    so the problem must be in the .pro
    Thank for advance
    Stephan

  4. #4
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Pb to install opencv2.3 under Qt

    QApplication is a part of QtGui module, so you can't disable this module if you want to use it:
    QT -= gui
    If you dont want gui module, use QCoreApplication.
    like cv.h and highgui.h.
    Do you have files cv.h and highgui.h in directories specified in INCLUDEPATH variable ?

  5. #5
    Join Date
    Aug 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Pb to install opencv2.3 under Qt

    Ok for your recommandation.
    What is it : Unescaped bachslashes are deprecated ligne 25
    I must having a problem of syntax

  6. #6
    Join Date
    Aug 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Pb to install opencv2.3 under Qt

    Thank you it's good. It was the .pro

Similar Threads

  1. opencv2.2 webcam
    By afro_cv in forum Qt Programming
    Replies: 3
    Last Post: 8th August 2011, 07:49
  2. OpenCV2.1 and Qt 4.7.4 integration
    By nackasha in forum Newbie
    Replies: 1
    Last Post: 20th July 2011, 23:31
  3. Replies: 6
    Last Post: 13th March 2011, 23:49
  4. Replies: 0
    Last Post: 12th March 2011, 19:46
  5. How install fonts with make install
    By jiveaxe in forum Qt Programming
    Replies: 1
    Last Post: 2nd January 2008, 19:38

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.