No Video in Python as cv2.imshow

Asked 2 years ago, Updated 2 years ago, 108 views

I'm a beginner.
http://opencv.blog.jp/python/install_easy and try to get python to use opencv to display the image, but the new window freezes and does not appear, either pythonxy or anaconda.

The code is

import cv2
import numpy as np
img=cv2.imread("test1")
cv2.imshow("test", img)

Yes.
The frozen message is init done opengl support available.Thank you for your cooperation.

python opencv

2022-09-30 21:22

1 Answers

It's different from Freeze, but it may have just ended quickly.
In that case, you can solve this problem by putting waitKey and so on.

#!/usr/bin/python2
import numpy as np
import cv2

img = cv2.imread ('./test.png', 0)

cv2.imshow('image',img')
cv2.waitKey(0)
cv2.destroyAllWindows()


2022-09-30 21:22

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.