gstreamer在opencv之间分享

时间:2016-08-10 14:41:03

标签: python opencv gstreamer

我使用gstreamer并通过以下方式从网络摄像头捕获图像:

gst-launch-1.0 -e rtspsrc location='rtsp://admin:admin@10.0.4.139:554/cam/realmonitor?channel=1&subtype=0' ! rtph264depay ! vpudec ! vpuenc_jpeg ! filesink location=/dev/video_stream0 -v

/ dev / video_stream0是mkfifo,但是当我想通过代码从OpenCv中获取jpeg时:

import cv2
cap = cv2.VideoCapture('/dev/video_stream0')
#cap = cv2.CreateFileCapture('/dev/video_stream0')
count = 0
while cap.isOpened():
    ret,frame = cap.read()
    cv2.imshow('window-name',frame)
    #cv2.imwrite("frame%d.jpg" % count, frame)
    count = count + 1
    if cv2.waitKey(10) & 0xFF == ord('q'):
        break


cap.release()
cap.destroyAllWindows()

它给了我错误

  

OpenCV错误:断言失败(size.width> 0&& size.height> 0)in   imshow,文件   /home/user/fsl-release-bsp/build-mcd/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/opencv/2.4.11+gitAUTOINC+2c9547e314-r0/git/modules/highgui/src /window.cpp,   第261行

如何在gstreamer和OpenCv之间共享例如jpeg? 如果有更简单的方式,如共享视频流或模拟相机设备,我将感激不尽。 谢谢

0 个答案:

没有答案