Issue
I am trying to run following script
import numpy as np
import cv2
#Capture Video from Camera
cap = cv2.VideoCapture(0)
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
# Our operations on the frame come here
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
# Display the resulting frame
cv2.imshow('frame',gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
when i tried to run it in the Ubuntu terminal it gives me this Qt: Session management error
and 2 unwanted frames along with my output.
can you guys help me how can i get rid of this error and those unwanted frames?
Solution
Guys after finding many blogs and resources finally i got this and it is worked for me.
Instead of using pip for opencv installation use below command
sudo apt install libopencv-dev python3-opencv
https://linuxize.com/post/how-to-install-opencv-on-ubuntu-20-04/
NOTE - I think this issue is with Ubuntu 20.04
Answered By - Mayur Satav Answer Checked By - Gilberto Lyons (WPSolving Admin)