I'm trying to display an image on screen using OpenCV, but nothing happens - all I see is a black screen.
No error message is received.
I'm using Mac and I have a secondary screen connected. When I run the code, both are turned black for 10 seconds but the image is not displayed. This is the code:
while True:
if not os.path.isfile(pic_name):
print("Wrong path: ", pic_name)
return
image = cv2.imread(pic_name, 0)
if image is not None:
print(image)
cv2.imshow('image', image)
k = cv2.waitKey(1000)
if k == 27: # If escape was pressed exit
cv2.destroyAllWindows()
break
break
return pic_time
Also - when printing the image as nd-array, values are good:
[[ 0 3 4 ... 239 220 3]
[ 0 2 0 ... 238 219 3]
[ 2 6 0 ... 237 218 2]
...
[ 0 26 127 ... 175 173 2]
[ 0 33 149 ... 169 168 3]
[ 3 22 145 ... 167 163 2]]
Thanks!