Results 1 to 13 of 13

Thread: Sample project ( QT4 + OpenCV) --> Request

  1. #1
    Join Date
    Jul 2011
    Location
    BRAZIL-RIO DE JANEIRO
    Posts
    47
    Thanks
    33
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Sample project ( QT4 + OpenCV) --> Request

    Hi Friends,


    Sorry if I´m asking for a stupid and recurrent issue, but really searched for some usable project here, but didn´t found.
    I am a JAVA and C++BUILDER ( not advanced ) programmer, but am newer at QT and OpenCV.
    I tryed to create a simple panel, just openning an image, but have a lot of problems, and don´t know exacly if the problem is at instalation or at creation itself.

    Colud somebody please give to me a web link, or sample project ?



    Thanks in advance !

    +++

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Sample project ( QT4 + OpenCV) --> Request

    "We can't solve problems by using the same kind of thinking we used when we created them." -- Einstein
    If you are posting code then please use [code] [/code] tags around it - makes addressing the problem easier.

  3. The following user says thank you to ChrisW67 for this useful post:

    andre_teprom (24th July 2011)

  4. #3
    Join Date
    Jul 2011
    Location
    BRAZIL-RIO DE JANEIRO
    Posts
    47
    Thanks
    33
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Sample project ( QT4 + OpenCV) --> Request

    Hi

    I appreciate too much your help.
    I downloaded the project, and after some remaining QT isntalations and PATH definitions, now is trying to compile.

    However, I guess is happening some problem at QT configuration ( or even, at instalation ).
    The project presents ~850 compilation errors.
    Not at include path, which are all corrected.
    But, those errors are concerned to sintax.

    I believe, that QT is compiling at some other language than ANSI-C ( C++ , G++ ).
    Could please provide to me some guidelines ?

    Thanks in advance...

    +++

  5. #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: Sample project ( QT4 + OpenCV) --> Request

    You can post in the linked thread, maybe others will benefit in the future.
    Post the compilation errors there, I'll try to help. This project was tested (compiled+run) on windows xp (gcc 4.4, Qt 4.5), windows vista (gcc 4.4, Qt 4.5), windows 7 (gcc 4.5, Qt 4.7.2) and ubuntu 9.10 (i dont remember), so I'm pretty sure the code does not contain any syntax errors.
    Qt is c++, not ANSI-C, so you need to have c++ compiler, I have tested this with g++, I dont know if it will work with Visual Studio compilers.

  6. The following user says thank you to stampede for this useful post:

    andre_teprom (24th July 2011)

  7. #5
    Join Date
    Jul 2011
    Location
    BRAZIL-RIO DE JANEIRO
    Posts
    47
    Thanks
    33
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Sample project ( QT4 + OpenCV) --> Request

    Hi stampede,


    I avoided to post at the other thread, due I believe that are too many posts there, and it turns hard to focuse on the punctual problem, but I appreciate too much your sugestion.
    ( sorry if this procedure is wrong ).

    Follows the screens of QT configuration.
    It can be seen that elementary sintax errors are occouring.
    I´m on : WIN-XP SP2 / QT 4.6.1
    What I´m doing wrong ?
    ( I believe that the compiler settings is not correct )

    -------




    -------




    -------



    -------



    Thanks in advance !

    +++
    Last edited by andre_teprom; 24th July 2011 at 17:12.

  8. #6
    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: Sample project ( QT4 + OpenCV) --> Request

    I have never tried to build this project with automatic builder, to be honest I'm not sure if these settings are correct, they look ok to me.
    It seems you are using qmake & mingw32-make, so why are you setting the cmake options ?
    Have you changed the .pro file that comes with the project ? If you are using OpenCV 2.3 then I think you need to change the paths in .pro file, because I was using OpenCV ver. 2.2.
    This is meant to be built within command line (I got quite used to it), so try to cd to the project directory and type in the console:
    qmake cv=2
    mingw32-make
    If you do not specify the cv=2 options, by default it will try to include and link to OpenCV 1.1. If you dont want to do that by hand, then just change the .pro file to always use OpenCV 2.3, make sure the paths are correct.
    Post the file content and your opencv paths if you are not sure how it should look like.

  9. The following user says thank you to stampede for this useful post:

    andre_teprom (24th July 2011)

  10. #7
    Join Date
    Jul 2011
    Location
    BRAZIL-RIO DE JANEIRO
    Posts
    47
    Thanks
    33
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Sample project ( QT4 + OpenCV) --> Request

    Hi stampede,

    I will check the other advices you gave.
    For while, I will post the .PRO content.
    Must I change the 2.2 values to 2.3 ?

    Qt Code:
    1. EMPLATE = app
    2. DESTDIR = bin
    3. TARGET = cvexample
    4. DEPENDPATH += . src/cpp src/h src/ui
    5. INCLUDEPATH += . src/h
    6.  
    7. UI_DIR = build
    8. MOC_DIR = build
    9.  
    10. build_pass:CONFIG(debug, debug|release){
    11. OBJECTS_DIR = build/debug
    12. } else{
    13. OBJECTS_DIR = build/release
    14. }
    15.  
    16. win32 {
    17. CV11_INCLUDE = C:/OpenCV
    18. CV11_LIB = C:/OpenCV/lib
    19. CV22_INCLUDE = C:/OpenCV2.2/modules
    20. CV22_LIB = C:/OpenCV2.2/build/bin
    21. } else{
    22. CV11_INCLUDE = /usr/local/include/OpenCV
    23. CV11_LIB = /usr/local/lib/OpenCV
    24. CV22_INCLUDE = /usr/local/include/OpenCV2.2
    25. CV22_LIB = /usr/local/lib/OpenCV2.2
    26. }
    27.  
    28. contains(cv,2){
    29. message(build with opencv 2.2)
    30. DEFINES += OPEN_CV_22
    31. INCLUDEPATH += $$CV22_INCLUDE/core/include/opencv2/core \
    32. $$CV22_INCLUDE/highgui/include/opencv2/highgui \
    33. $$CV22_INCLUDE/imgproc/include/opencv2/imgproc \
    34. $$CV22_INCLUDE/core/include \
    35. $$CV22_INCLUDE/imgproc/include
    36. LIBS += -L$$CV22_LIB
    37. LIBS += -lopencv_highgui220 -lopencv_core220 -lopencv_imgproc220
    38. } else{
    39. message(build with opencv 1.1)
    40. DEFINES -= OPEN_CV_22
    41. INCLUDEPATH += $$CV11_INCLUDE/cv/include $$CV11_INCLUDE/otherlibs/highgui $$CV11_INCLUDE/cxcore/include
    42. LIBS += -L$$CV11_LIB
    43. LIBS += -lcv -lhighgui -lcxcore
    44. }
    45.  
    46. HEADERS += src/h/ImageCapture.h src/h/MainWidget.h
    47. FORMS += src/ui/MainWidget.ui
    48. SOURCES += src/cpp/ImageCapture.cpp src/cpp/MainWidget.cpp main.cpp
    To copy to clipboard, switch view to plain text mode 

    +++

  11. #8
    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: Sample project ( QT4 + OpenCV) --> Request

    If you have OpenCV 2.3, then yes, change the paths to match your system.
    Here is simplified .pro file, fill the paths yourself:
    Qt Code:
    1. TEMPLATE = app
    2. DESTDIR = bin
    3. TARGET = cvexample
    4. DEPENDPATH += . src/cpp src/h src/ui
    5. INCLUDEPATH += . src/h
    6.  
    7. UI_DIR = build
    8. MOC_DIR = build
    9.  
    10. build_pass:CONFIG(debug, debug|release){
    11. OBJECTS_DIR = build/debug
    12. } else{
    13. OBJECTS_DIR = build/release
    14. }
    15.  
    16. # here, fille the correct path, if you have Opencv 2.3 in C:/OpenCV2.3/ then leave this as is
    17. CV22_INCLUDE = C:/OpenCV2.3/modules
    18. CV22_LIB = C:/OpenCV2.3/build/bin
    19.  
    20. DEFINES += OPEN_CV_22
    21. INCLUDEPATH += $$CV22_INCLUDE/core/include/opencv2/core \
    22. $$CV22_INCLUDE/highgui/include/opencv2/highgui \
    23. $$CV22_INCLUDE/imgproc/include/opencv2/imgproc \
    24. $$CV22_INCLUDE/core/include\
    25. $$CV22_INCLUDE/imgproc/include
    26. LIBS += -L$$CV22_LIB
    27. LIBS += -lopencv_highgui230 -lopencv_core230 -lopencv_imgproc230
    28.  
    29. HEADERS += src/h/ImageCapture.h src/h/MainWidget.h
    30. FORMS += src/ui/MainWidget.ui
    31. SOURCES += src/cpp/ImageCapture.cpp src/cpp/MainWidget.cpp main.cpp
    To copy to clipboard, switch view to plain text mode 

  12. The following user says thank you to stampede for this useful post:

    andre_teprom (24th July 2011)

  13. #9
    Join Date
    Jul 2011
    Location
    BRAZIL-RIO DE JANEIRO
    Posts
    47
    Thanks
    33
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Sample project ( QT4 + OpenCV) --> Request

    Hi,

    I already had performed that changes by other way, but even replacing by your file still is not working.
    I believe the reason could be at __cplusplus directive definition ( I noticed here is '1' ).

    Could you please check that compiling error messages and infer some cause ?



    +++

  14. #10
    Join Date
    Jul 2011
    Location
    BRAZIL-RIO DE JANEIRO
    Posts
    47
    Thanks
    33
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Sample project ( QT4 + OpenCV) --> Request

    Great nwes !


    I solve most problems, and remains just one ( I hope to be an elementary issue, regarding to tool configuration subject ).
    Could check it please ?

    collect2: ld returned 1 exit status
    mingw32-make.exe[1]: *** [bin\cvexample.exe] Error 1
    C:\MinGW\bin\mingw32-make.exe: *** [debug] Error 2
    Exited with code 2.


    +++

  15. #11
    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: Sample project ( QT4 + OpenCV) --> Request

    I'm glad you have it solved, maybe you can post how did you do that, so that others could use your solution in the future.
    And yes, this should be easy to solve, this:
    CV22_LIB = C:/OpenCV2.3/build/bin
    should point to a directory containing libopencv_core230.dll and libopencv_highgui230.dll (if you are using opencv 2.3), if those files are in other directory, change this value. After you do that, copy the .dlls to a directory where cvexample.exe is located (default is "bin" folder in project directory), because you will have problems with running the app.

  16. The following user says thank you to stampede for this useful post:

    andre_teprom (26th July 2011)

  17. #12
    Join Date
    Jul 2011
    Location
    BRAZIL-RIO DE JANEIRO
    Posts
    47
    Thanks
    33
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Sample project ( QT4 + OpenCV) --> Request

    Hi,

    You´re right about to share the solution, but the way I did to solve the problem is almost stupid.
    I changed all paths at include files in OpenCV files ( c , h , cpp , hpp ).

    In fact, I had to use other LIB path than what you sugested above, due there was nothing there :
    CV22_LIB = C:\OpenCV2.3\build\x86\mingw\bin
    I will copy the DLLs and post results here later.
    Thanks a lot !

    +++



    --------------------------------

    Added after 29 minutes:

    --------------------------------



    Hi,


    I did what you sugested, but did not work, returning following exit code at QT Creator IDE : 1073741511
    When I run generated EXE file, the above message appears ( my Windows is at Portugueese language ), warning that is missing an input entry to the LIBSTDC++-6.DLL:

    Note that I put all related files at the same Bin folder where executable is on :

    Do you know what I could try to solve this ?

    The most strange, is that running a sample QT project, works fine.

    +++
    Last edited by andre_teprom; 26th July 2011 at 04:24.

  18. #13
    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: Sample project ( QT4 + OpenCV) --> Request

    Where did you get this libstdc++-6.dll from ? Try to use the one that comes with your mingw installation.

Similar Threads

  1. UTF-8 Issues in Sample
    By trevelyan in forum Newbie
    Replies: 6
    Last Post: 19th May 2011, 01:41
  2. Request ID of QNetworkaccessmanager get and post request
    By dineshkumar in forum Qt Programming
    Replies: 2
    Last Post: 4th February 2011, 21:56
  3. Replies: 4
    Last Post: 18th November 2010, 13:00
  4. Sample for Mutithreading
    By HugoHiasl in forum Qt Programming
    Replies: 19
    Last Post: 1st July 2010, 07:43
  5. Qhttp::request(...) method and GET request
    By mikhailt in forum Qt Programming
    Replies: 4
    Last Post: 15th September 2006, 12:26

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.