views:

448

answers:

1

I have a strange problem with opencv running on an Ubuntu. I installed OpenCV from the apt sources. And most of the Examples work fine.

But in my programs, which are working with Mac OS, no windows are created.

The following code is showing a window and an image in this on my Mac but not on my Ubuntu powered machine

import time
from opencv import highgui

if __name__ == '__main__':

    highgui.cvNamedWindow('Image', highgui.CV_WINDOW_AUTOSIZE)
    highgui.cvMoveWindow('Image', 10, 40)
    image = highgui.cvLoadImage("verena.jpg", 1)
    highgui.cvShowImage('Image', image)
    time.sleep(3)

The code is taken from one of the examples that is actually working on both machines.

+1  A: 

The code works if I add a highgui.cvStartWindowThread() call before creating the window.

Now the next question would be why the program works on mac os without starting the windowThread.

Janusz