Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Qt Opencv Integration

Qt Opencv Integration

Scheduled Pinned Locked Moved 3rd Party Software
15 Posts 6 Posters 11.1k Views
  • 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.
  • P Offline
    P Offline
    pumper
    wrote on last edited by
    #1

    Hi
    I am using qt sdk 1.2(qt 4.8 , creator 2.4.1) and i want to use opencv
    so I downloaded opencv2.3.1 and unpacked it to c:
    I wrote a simple code like hello world :
    @
    #include <opencv2/core/core.hpp>
    #include <opencv2/highgui/highgui.hpp>
    using namespace cv;

    int main(void)
    {
    IplImage *img=cvLoadImage("c:\IMG_0300.jpg");
    cvNamedWindow("window");
    cvShowImage("window",img);
    cvWaitKey();
    return 1;
    }
    @
    and for adding libs to my project my pro file is like this:
    @
    TEMPLATE = app
    CONFIG += console
    CONFIG -= qt

    SOURCES += main.cpp
    HEADERS += C:\Opencv\build\include\opencv2\core\core.hpp
    C:\Opencv\build\include\opencv2\highgui\highgui.hpp

    INCLUDEPATH+=C:\Opencv\build\include\

    win32: LIBS += -L$$PWD/../../../Opencv/build/x86/mingw/lib/ -llibopencv_core231
    -llibopencv_highgui231
    INCLUDEPATH += $$PWD/../../../Opencv/build/include/
    DEPENDPATH += $$PWD/../../../Opencv/build/x86/mingw/bin/
    @
    but every time i run the project I see a console window that ask me to press return to close this window.
    and application output says that exited with code 0
    whats the problem ?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      You have no problem. This is showing only the error code on exit of your program. 0 is considered as no error.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pumper
        wrote on last edited by
        #3

        but my program must show me a window and the picture on it what happens to them ?

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          Oh, sorry, I have misinterpret your issue then.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • P Offline
            P Offline
            pumper
            wrote on last edited by
            #5

            now do you know whats the problem ?
            I changed the pro file like this and same result nothing changed.
            @
            TEMPLATE = app
            CONFIG += console
            CONFIG -= qt

            SOURCES += main.cpp

            INCLUDEPATH += C:\opencv\build\include
            INCLUDEPATH += "C:\opencv\modules\core\include"
            "C:\opencv\modules\highgui\include"
            BASE_PATH = c:/opencv/build/x86/mingw
            CONFIG(release,debug|release)
            {
            win32: LIBS += -L$$BASE_PATH/lib/ -llibopencv_calib3d231
            -llibopencv_contrib231
            -llibopencv_core231
            -llibopencv_features2d231
            -llibopencv_flann231
            -llibopencv_gpu231
            -llibopencv_highgui231
            -llibopencv_imgproc231
            -llibopencv_legacy231
            -llibopencv_ml231
            -llibopencv_objdetect231
            -llibopencv_video231
            }
            CONFIG(debug,debug|release)
            {
            win32: LIBS += -L$$BASE_PATH/lib/ -llibopencv_calib3d231
            -llibopencv_contrib231
            -llibopencv_core231
            -llibopencv_features2d231
            -llibopencv_flann231
            -llibopencv_gpu231
            -llibopencv_highgui231
            -llibopencv_imgproc231
            -llibopencv_legacy231
            -llibopencv_ml231
            -llibopencv_objdetect231
            -llibopencv_video231
            }

            @

            1 Reply Last reply
            0
            • D Offline
              D Offline
              deimos
              wrote on last edited by
              #6

              can you try to use ?

              @cvWaitKey(0);@

              edit: and maybe also without CONFIG += console

              1 Reply Last reply
              0
              • P Offline
                P Offline
                pumper
                wrote on last edited by
                #7

                I tried these before nothing changed with these

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  pumper
                  wrote on last edited by
                  #8

                  one point may be help.
                  when i try to debug program i get this error box :

                  @
                  During the startup program exited with code 0xc0000005
                  @
                  and then another eooro box :
                  @
                  the gdb process exited unexpectedly (code 0)
                  @

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    pumper
                    wrote on last edited by
                    #9

                    one interesting thing :
                    when i put build configuration to msvc10 the program runs corectly
                    but when i put it on mingw build every thing is like what i said before.
                    any sugestions ?

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      pumper
                      wrote on last edited by
                      #10

                      no idea?
                      no one can help?

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        Scylla
                        wrote on last edited by
                        #11

                        Do you have the Dll's in path?

                        1 Reply Last reply
                        0
                        • P Offline
                          P Offline
                          pumper
                          wrote on last edited by
                          #12

                          I copied dll's to the directory of EXE file and system32

                          1 Reply Last reply
                          0
                          • P Offline
                            P Offline
                            pumper
                            wrote on last edited by
                            #13

                            I did it.
                            finally I've downloaded mingw32 and cmake and rebuild opencv from source with qt support and it worked like a charm.

                            1 Reply Last reply
                            0
                            • G Offline
                              G Offline
                              gautham
                              wrote on last edited by
                              #14

                              i used the above include path files in qt but i am getting some errors like cannot open the library file calib3d231.

                              1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                moondark
                                wrote on last edited by
                                #15

                                hello,

                                I have met the same problem, have u solved it?

                                I have tried again and again, but it didn't work

                                However, I have successed once, when I did something and restarted qt creator, but since I rewrite the .pro, it crashed. Except this, all are the same with you.

                                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