cv2.error:OpenCV(4.5.3)出现在树莓派中
我尝试使用 Raspberry Pie 使用下面的代码测试 Picam。
import cv2
def main():
camera = cv2.VideoCapture(-1)
camera.set(3,640)
camera.set(4,480)
while( camera.isOpened() ):
_, image = camera.read()
cv2.imshow( 'camera test' , image)
if cv2.waitKey(1) == ord( 'q '):
break
cv2.destroyAllWindows()
if __name__ == '__main__':
main()
但是,会出现此错误。
cv2.error: OpenCV(4.5.3) /tmp/pip-wheel-hwcmjluw/opencv-
python_dc56ddd000dd4893b1f852d88d4a5959/opencv/modules/core/src/arra
y.cpp:2494:error: (-206:Bad flag (parameter or structure field))
Unrecognized orunsupported array type in function 'cvGetMat'
我应该怎么办?
I tried to test Picam with the code below with Raspberry Pie.
import cv2
def main():
camera = cv2.VideoCapture(-1)
camera.set(3,640)
camera.set(4,480)
while( camera.isOpened() ):
_, image = camera.read()
cv2.imshow( 'camera test' , image)
if cv2.waitKey(1) == ord( 'q '):
break
cv2.destroyAllWindows()
if __name__ == '__main__':
main()
However, this error occurs.
cv2.error: OpenCV(4.5.3) /tmp/pip-wheel-hwcmjluw/opencv-
python_dc56ddd000dd4893b1f852d88d4a5959/opencv/modules/core/src/arra
y.cpp:2494:error: (-206:Bad flag (parameter or structure field))
Unrecognized orunsupported array type in function 'cvGetMat'
What should I do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
OpenCV 不喜欢
ord( 'q ')
中的空格。我正在使用 OpenCv 4.5.5/Bullseye。使用 picamera v1.它将起作用 picamera v2.import cv2OpenCV doesn't like whitespaces in
ord( 'q ')
. I am using OpenCv 4.5.5/Bullseye. Using picamera v1. It will worked picamera v2.import cv2