Opencv imshow() freezes when updating
<p>For my image processing algorithm I'm using python / OpenCV. The output of my algorithm shall be updated im the same window over and over again. </p>

<p>However sometimes the window freezes and doesn't update at all, but the algorithm is still running and updated the picture a multiple times in the meantime. The window turns dark gray on this Ubuntu machine.</p>

<p>Here is an excerpt of the involved code:</p>

<pre><code>for i in range(0,1000):
    img = loadNextImg()
    procImg = processImg(img)
    cv2.imshow("The result", procImg)
    cv2.waitKey(1)
</code></pre>

<p><strong>N.B.</strong>: processImg() takes about 1-2 s for its procedures. The line <code>cv2.imshow(procImg)</code> creates the window in first instance (i.e. there is no preceding invocation)</p>