HighGUI (OpenCV) window from IPython


If you run an interactive ipython session, and want to use highgui windows, do cv2.startWindowThread() first.

In detail: HighGUI is a simplified interface to display images and video from OpenCV code. It should be as easy as:

import cv2
img = cv2.imread("image.jpg")
cv2.imshow("preview", img)

It does work from the script, but it doesn't work from the interactive ipython session (no windows appears until waitKey, the window remains black. Run cv2.startWindowThread() and it'll work as intended.