Home > Software engineering >  Why doesnt .imshow function in opencv work?
Why doesnt .imshow function in opencv work?

Time:01-27

I tried to run following code but absolutely nothing happened, console just wrote "image found" but no window showed up. Doesn't somebody know where is the problem?

import cv2 as cv

img = cv.imread(cv.samples.findFile("/home/dan/Desktop/9464.jpg"))
if img is not None:
    print("image found")

cv.imshow("Picture", img)
cv.waitKey(0)
cv.destroyAllWindows()

CodePudding user response:

Ok, its some problem of pycharm because when i ran it normally in terminal, it worked, but i have no idea where is the problem...

Ok, so i finally found out that problem was in wrong interpreter:)

CodePudding user response:

waitKey(0) wait for eternity. Use waitKey(1) in while loop.

  •  Tags:  
  • Related