Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

cv2 imshow displaying black images sometimes

I am trying out cv2 on ubuntu 20.04, python 3.7. I have run the following script import cv2 img = cv2.imread('butterfly.jpg') cv2.imshow('ImageWindow', img) cv2.waitKey() Sometimes I would get the lovely picture of the original butterfly image, butterfly

but sometimes I would get a small black window. cv2error

The behavior is a bit random, and I am not sure what is causing this issue. Any help is appreciated, thanks!

cv2 imshow displaying black images sometimes

I am trying out cv2 on ubuntu 20.04, python 3.7. I have run the following script script:

 import cv2
 img = cv2.imread('butterfly.jpg')
 cv2.imshow('ImageWindow', img)
 cv2.waitKey()

Sometimes I would get the lovely picture of the original butterfly image, butterfly

but sometimes I would get a small black window.

cv2error

The behavior is a bit random, and I am not sure what is causing this issue. Any help is appreciated, thanks!