Ask Your Question

marioviti's profile - activity

2017-02-13 11:22:41 -0600 answered a question Python & OpenCV 3.1: imshow fail when called in different thread

Hi,

the imshow function is not thread safe. A thread must acquire a lock before showing the image and release it afer the specified time in the waitKey function has passed.

In python is really easy, define a lock in your code and add in the run method of your thread:

with image_lock: 
     cv2.imshow('image',self.image)
     cv2.waitKey(25)

Hope it'll help.