Results 1 to 3 of 3

Thread: Cannot call OpenCV 2.0 functions inside Qt slots

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Cannot call OpenCV 2.0 functions inside Qt slots

    Hi all,

    I have a Qt (4.6 mingw) application that uses OpenCV (2.0) for image processing.

    Everything was working fine with OpenCV 1.0 but when I upgraded to
    OpenCV 2.0 it started crashing.
    I noticed that it only crashes whenever OpenCV functions are called
    inside Qt slots.

    For instance, the following slot:

    Qt Code:
    1. void TestClass::on_testButton_clicked() {
    2. IplImage* src = cvLoadImage("test.jpg");
    3. IplImage* dst = cvCreateImage(cvGetSize(src), src->depth, src->nChannels);
    4. cvThreshold(src, dst, 100, 255, CV_THRESH_BINARY);
    5. }
    To copy to clipboard, switch view to plain text mode 

    crashes when testButton is clicked.

    However:
    If I call the same cvThreshold function in any other place such as main or the Widget's constructor, it works.
    If f I put the same code in a separate function and call that function with QtConcurrent::run() inside the same slot, it works.
    If I use OpenCV 1.0, it works.

    Why this behaviour? Are there any restrictions about the operations that can be done inside Qt slots?

    Thanks in advance.
    Last edited by Asfer; 19th February 2010 at 11:48.

Similar Threads

  1. Replies: 4
    Last Post: 16th February 2009, 07:10
  2. Replies: 3
    Last Post: 4th March 2008, 08:35
  3. trying to call Xlib inside qt app
    By phixx in forum Qt Programming
    Replies: 4
    Last Post: 12th February 2008, 20:28
  4. Replies: 1
    Last Post: 6th April 2006, 12:24
  5. virtual overloaded functions and base class function call...
    By nouknouk in forum General Programming
    Replies: 7
    Last Post: 11th March 2006, 21:26

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
  •  
Qt is a trademark of The Qt Company.