Reputation: 2391
When I try to use cv2.imshow()
it gives a shows the image for a second, then makes the window go gray. I can't seem to find anything about it, except that I should use cv2.waitKey(0)
, which I am, and also to use cv2.namedWindow()
. My code:
import numpy as np
import cv2
import sys
cv2.namedWindow('img')
img = cv2.imread(sys.argv[1])
cv2.imshow('img', img)
cv2.waitKey(0)
cv2.destroyAllWindows
Again, it shows the image for a second and then grays it out. Thanks in advance.
Upvotes: 4
Views: 6854
Reputation: 84
try this:
import cv2
import sys
img = cv2.imread(sys.argv[1])
cv2.imshow('img', img)
cv2.waitKey()
Upvotes: 6