|
按照人工智能开发系列(3) YOLOV3开发与实现这个帖子搭建的环境,执行
- sudo dnf install gstreamer-rockchip
后,无法打开UVC摄像头:camera.py:
- import numpy as np
- import cv2
- import matplotlib.pyplot as plot
- cap = cv2.VideoCapture(0)
- while(True):
- ret,frame = cap.read()
- cv2.imshow("capture",frame)
- if cv2.waitKey(1) & 0xFF == ord('q'):
- break
- cap.release()
执行:python camera.py
- OpenCV(3.4.1) Error: Unspecified error (GStreamer: unable to start pipeline
- ) in cvCaptureFromCAM_GStreamer, file /builddir/build/BUILD/opencv-3.4.1/modules/videoio/src/cap_gstreamer.cpp, line 890
- VIDEOIO(cvCreateCapture_GStreamer(CV_CAP_GSTREAMER_V4L2, reinterpret_cast<char *>(index))): raised OpenCV exception:
- OpenCV(3.4.1) /builddir/build/BUILD/opencv-3.4.1/modules/videoio/src/cap_gstreamer.cpp:890: error: (-2) GStreamer: unable to start pipeline
- in function cvCaptureFromCAM_GStreamer
- OpenCV(3.4.1) Error: Unspecified error (unicap: failed to get info for device
- ) in CvCapture_Unicap::initDevice, file /builddir/build/BUILD/opencv-3.4.1/modules/videoio/src/cap_unicap.cpp, line 139
- VIDEOIO(cvCreateCameraCapture_Unicap(index)): raised OpenCV exception:
- OpenCV(3.4.1) /builddir/build/BUILD/opencv-3.4.1/modules/videoio/src/cap_unicap.cpp:139: error: (-2) unicap: failed to get info for device
- in function CvCapture_Unicap::initDevice
- OpenCV(3.4.1) Error: Assertion failed (size.width>0 && size.height>0) in imshow, file /builddir/build/BUILD/opencv-3.4.1/modules/highgui/src/window.cpp, line 364
- Traceback (most recent call last):
- File "camera.py", line 7, in <module>
- cv2.imshow("capture",frame)
- cv2.error: OpenCV(3.4.1) /builddir/build/BUILD/opencv-3.4.1/modules/highgui/src/window.cpp:364: error: (-215) size.width>0 && size.height>0 in function imshow
本地视频也无法打开!
|
|