Results 1 to 7 of 7

Thread: Can't debug the program with OpenCV in Qt Creator

  1. #1
    Join Date
    Apr 2012
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Can't debug the program with OpenCV in Qt Creator

    Hello everyone.
    When I choose msvc2010 release compiler in Qt Creator,it works well,even though I get a message ".pro:22: Warnning:Unescaped backslashes are deprecated".But when I choose msvc2010 debug compiler,it will show message "Unrecognized or unsupported array type in cvGetMat function" in console and a messagebox "Runtime Error".I never used that function because I only use the C++ interface of OpenCV.
    Here is the code of my .pro file.
    Qt Code:
    1. #-------------------------------------------------
    2. #
    3. # Project created by QtCreator 2012-05-24T11:07:57
    4. #
    5. #-------------------------------------------------
    6. QT += core
    7. QT -= gui
    8. TARGET = morphological_filters
    9. CONFIG += console
    10. CONFIG -= app_bundle
    11. TEMPLATE = app
    12. SOURCES += main.cpp \
    13. morphofeatures.cpp \
    14. watershedsegmenter.cpp
    15. INCLUDEPATH +=D:\OpenCV\opencv\build\include\opencv2 \
    16. D:\OpenCV\opencv\build\include\opencv \
    17. D:\OpenCV\opencv\build\include
    18. CONFIG(release,debug|release)
    19. {
    20. LIBS += D:\OpenCV\opencv\build\x86\vc10\lib\opencv_calib3d231.lib \
    21. D:\OpenCV\opencv\build\x86\vc10\lib\opencv_contrib231.lib \
    22. D:\OpenCV\opencv\build\x86\vc10\lib\opencv_core231.lib \
    23. D:\OpenCV\opencv\build\x86\vc10\lib\opencv_features2d231.lib \
    24. D:\OpenCV\opencv\build\x86\vc10\lib\opencv_flann231.lib \
    25. D:\OpenCV\opencv\build\x86\vc10\lib\opencv_gpu231.lib \
    26. D:\OpenCV\opencv\build\x86\vc10\lib\opencv_highgui231.lib \
    27. D:\OpenCV\opencv\build\x86\vc10\lib\opencv_imgproc231.lib \
    28. D:\OpenCV\opencv\build\x86\vc10\lib\opencv_legacy231.lib \
    29. D:\OpenCV\opencv\build\x86\vc10\lib\opencv_ml231.lib \
    30. D:\OpenCV\opencv\build\x86\vc10\lib\opencv_objdetect231.lib \
    31. D:\OpenCV\opencv\build\x86\vc10\lib\opencv_ts231.lib \
    32. D:\OpenCV\opencv\build\x86\vc10\lib\opencv_video231.lib
    33. }
    34. CONFIG(debug,debug|release)
    35. {
    36. LIBS +=D:\OpenCV\opencv\build\x86\vc10\lib\opencv_calib3d231d.lib \
    37. D:\OpenCV\opencv\build\x86\vc10\lib\opencv_contrib231d.lib \
    38. D:\OpenCV\opencv\build\x86\vc10\lib\opencv_core231d.lib \
    39. D:\OpenCV\opencv\build\x86\vc10\lib\opencv_features2d231d.lib \
    40. D:\OpenCV\opencv\build\x86\vc10\lib\opencv_flann231d.lib \
    41. D:\OpenCV\opencv\build\x86\vc10\lib\opencv_gpu231d.lib \
    42. D:\OpenCV\opencv\build\x86\vc10\lib\opencv_highgui231d.lib \
    43. D:\OpenCV\opencv\build\x86\vc10\lib\opencv_imgproc231d.lib \
    44. D:\OpenCV\opencv\build\x86\vc10\lib\opencv_legacy231d.lib \
    45. D:\OpenCV\opencv\build\x86\vc10\lib\opencv_ml231d.lib \
    46. D:\OpenCV\opencv\build\x86\vc10\lib\opencv_objdetect231d.lib \
    47. D:\OpenCV\opencv\build\x86\vc10\lib\opencv_ts231d.lib \
    48. D:\OpenCV\opencv\build\x86\vc10\lib\opencv_video231d.lib
    49. }
    50. HEADERS += \
    51. morphofeatures.h \
    52. watershedsegmenter.h
    To copy to clipboard, switch view to plain text mode 
    Last edited by nimingzhe2008; 30th May 2012 at 08:20. Reason: updated contents

  2. #2
    Join Date
    May 2008
    Posts
    155
    Thanked 15 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Can't debug the program with OpenCV in Qt Creator

    Use forward slashs, or quote the file names. You can save a lot of typing by using variabls: CVLIB=D:/OpenCV/opencv/build/x86/vc10/lib, and later LIBS += $$CVLIB/opencv_calib.lib, or in case of the libs even LIBS += -LD:/OpenCV/opencv/build/x86/vc10/lib, LIBS += opencv_calib3d231 opencv_core231 ... etc.

  3. #3
    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: Can't debug the program with OpenCV in Qt Creator

    The qmake warning is what it says: qmake would rather you used forward slashes everywhere in PRO files (or you can choose to double every literal backslash ) but you can get away with it for now.

    The OpenCV library is outputting this debug message because the messages are turned on when built in debug mode. Debug builds outputting more informational and warning messages is not surprising. The fact that you do not directly call that function is irrelevant: How do you think the C++ interface is implemented? The OpenCV warning is not a Qt or compiler issue.

  4. #4
    Join Date
    Apr 2012
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Can't debug the program with OpenCV in Qt Creator

    But why can I release successfully but can't debug?

  5. #5
    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: Can't debug the program with OpenCV in Qt Creator

    What do you mean you can't debug? The message you are complaining about is a run time message indicating that a parameter you have passed is in some way unacceptable. Run the program in your debugger and when it throws it exception look at the stack back trace to find where in your code the call is coming from.

  6. #6
    Join Date
    Apr 2012
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Can't debug the program with OpenCV in Qt Creator

    For example,I want load and show an image with code

    Qt Code:
    1. #include <QtCore/QCoreApplication>
    2. #include<opencv.hpp>
    3. using namespace cv;
    4.  
    5. int main(int argc, char *argv[])
    6. {
    7. QCoreApplication a(argc, argv);
    8. Mat image=imread("E:\\library\\Pictures\\images\\Lena.jpg");
    9. imshow("image",image);
    10.  
    11. return a.exec();
    12. }
    To copy to clipboard, switch view to plain text mode 

    If I choose msvc2010 release compiler in Qt Creator,the image will show correctly.But if I choose msvc2010 debug compiler,no image will show.

  7. #7
    Join Date
    Jun 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Can't debug the program with OpenCV in Qt Creator

    hi nimingzhe2008
    can u plz attach me those files

Similar Threads

  1. OpenCV integration with Qt creator
    By mind_freak in forum Qt Programming
    Replies: 11
    Last Post: 8th January 2013, 23:50
  2. Qt Creator and OpenCV , .dll missing
    By schludy in forum Newbie
    Replies: 0
    Last Post: 30th November 2011, 11:11
  3. Replies: 1
    Last Post: 12th September 2011, 12:34
  4. Problem with openCV compilation in Qt Creator
    By mind_freak in forum Qt Programming
    Replies: 2
    Last Post: 22nd February 2011, 13:26
  5. Using OpenCV with QT creator
    By gmiller39 in forum Newbie
    Replies: 3
    Last Post: 7th July 2010, 16:32

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.