OpenCv + Gstreamer + linux上的python

问题描述 投票:2回答:1

我告诉他们,我需要用Gstreamer Hayo实现opencv,而不是如何在管道gstreamer上用opencv编写。想法是通过OpenCV拍摄图像和网络摄像头,并使用GStreamer处理一些过滤器。

同样,如果我想告诉VideoCapture()从v4l2src设备= / dev / video1中获取数据,或者无法在v4l2src设备= / dev / video0中写入数据(使用linux,并且我有一个disp虚拟视频video0 )引发以下错误

GStreamer:在手动管道中找不到应用程序接收器 在函数cvCaptureFromCAM_GStreamer中]

import cv2

cv2.namedWindow('webCam')
cap = cv2.VideoCapture(1)  # "v4l2src device=/dev/video1"
# cap.open("img/bg.avi")


if cap.isOpened():
    ret, frame = cap.read()
else:
    ret = False
    print "problema aqui?"


while True:
    #se toma cada frame
    ret,frame = cap.read()
    frame = cv2.flip(frame,1)

    cv2.imshow('webCam', frame)

    width = cap.get(cv2.CAP_PROP_FRAME_WIDTH)
    height = cap.get(cv2.CAP_PROP_FRAME_HEIGHT)
    # cv2.imwrite("/dev/video0", frame)
    fourcc = cv2.VideoWriter_fourcc('m','p','4','v')
    pathVid = "/dev/video0" # 'img/output2.avi'
    # out = cv2.VideoWriter(pathVid, fourcc, 30, (width,height))
    out = cv2.VideoWriter(pathVid, fourcc, 30, (640,480))
    out.write(frame)
    cv2.VideoWr
    esc = cv2.waitKey(5) & 0xFF == 27
    if esc:
        break

cap.release()
cv2.destroyAllWindows()
    

我告诉他们,我需要用Gstreamer Hayo实现opencv,而不是如何在管道gstreamer上用opencv编写。这个想法是通过OpenCV拍摄图像和网络摄像头,并处理一些...

python linux opencv gstreamer pygst
1个回答
0
投票

首先尝试以下cmd:

© www.soinside.com 2019 - 2024. All rights reserved.