我正在尝试运行以下脚本
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()
当我尝试在Ubuntu终端中运行它时,它会给我这个Qt: Session management error
和2个不需要的帧以及我的输出。
你们能帮助我如何摆脱这个错误和那些不必要的错误 框架?
答案 0 :(得分:1)
伙计们在找到许多博客和资源后终于得到了它,并且对我有用。
使用pip代替opencv安装,请使用以下命令
sudo apt install libopencv-dev python3-opencv
https://linuxize.com/post/how-to-install-opencv-on-ubuntu-20-04/
注意-我认为此问题与Ubuntu 20.04有关