CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2009
    Posts
    63

    (linux) OpenCV and GUI at same time

    Hello,

    I am currently developing an application that needs to be able to both use OpenCV (computer vision library) optimally, and at the same time offer the user a nice graphical interface, all on ubuntu linux. thus far i have tried to integrate gtkmm and opencv using pthreads - using one thread for the image capturing and processing, and another for the graphical user interface. this has not worked, however, as it seems that using gtkmm in conjunction with pthreads is a no-go: while the thread with the GUI starts up fine, the thread initialized second (containing the image processing procedures from OpenCV) does not proceed until the thread containing the GUI has been terminated.

    does anyone know of a good way to integrate these two?

    thank you!

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: (linux) OpenCV and GUI at same time

    That high-level approach will work fine, but there are a few gotchas to watch out for. First of all, every GTKmm call which affects the GUI in any way must be made in the GUI thread. Under GTK+ I would have done this using g_idle_add(), but a cursory glance at the GTKmm docs doesn't show what the correct alternative is.

    Second, you'll need to call Glib::thread_init() at the start of the program even though you're using pthreads rather than gthreads. This will cause certain functions to become multithreading-aware.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured