Reputation: 3
I am trying trying to display webcam footage using openCV on Ubuntu but i am getting the following error:
Error: BadDrawable (invalid Pixmap or Window parameter) 9Major opcode: 62 (X_CopyArea)Resource id: 0x3800056]
Here is my full code
import cv2
cap = cv2.VideoCapture(1)
cap.set(3,320)
cap.set(4,240)
while(1):
_, frame = cap.read()
cv2.imshow('frame',frame)
k = cv2.waitKey(5) & 0xFF
if k == 27:
break
cap.release()
cv2.destroyAllWindows()
I have tried googling the error and it seems to be GUI related. I have also read the docs on imshow and I seem to be calling it fine, can anyone figure out why I am getting this error.
Thanks
Upvotes: 0
Views: 1309
Reputation: 2109
Seems like a problem when Python tries to present the window. It's probably an OS issue. Try editing the /etc/environment
.
sudo nano /etc/environment
Add this line:
QT_X11_NO_MITSHM=1
Also try running your app as sudo
and checking this for any solutions if before mentioned doesn't help.
Upvotes: 1