A
A
agentx0012016-06-18 21:29:51
Python
agentx001, 2016-06-18 21:29:51

Why doesn't OpenCV+Python work?

After much torment and dancing with a tambourine, I installed OpenCV. But the above code refuses to work: the window that I create appears and freezes...

import cv2

image = cv2.imread("plan.png")

cv2.namedWindow("main", cv2.WINDOW_AUTOSIZE)

cv2.imshow("main", image)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2016-06-19
@fox_12

Try like this:

import cv2
image = cv2.imread("plan.png")
cv2.namedWindow("main", cv2.WINDOW_AUTOSIZE)
while(1):
    cv2.imshow("main", image)
    k = cv2.waitKey(1) & 0xFF
    if k == 27:
        break

Exit - by pressing the "Esc" key

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question