There is a closed issue in openCV:
https://github.com/skvark/opencv-python/issues/134
that i want to work around in the https://github.com/WolfgangFahl/play-chess-with-a-webcam application.
e.g. when running:
scripts/runweb --detector=simple8x8 --autowarp --debug --input testMedia/scholarsmate.avi
this crash will happen.
In this example the webgui mode of the application will be called which uses the same videoanalyze class as the command line version:
scripts/runweb --detector=simple8x8 --autowarp --debug --input testMedia/scholarsmate.avi
which runs fine. The crucial call is in the video class according to the bug the showImage method needs to check if we are on the main thread.
How could i check whether on the main thread and then avoid the cv2.imshow command?
There is an answer for java but i don't know how to do this in python...
# show the image with the given title
def showImage(self, image, title, keyCheck=True, keyWait=5):
cv2.imshow(title, image)
if keyCheck:
return not cv2.waitKey(keyWait) & 0xFF == ord('q')
else:
return True