更改gstreamer -pipeline以输出RGB

时间:2019-11-01 11:09:51

标签: python camera gstreamer rgb nvidia-jetson-nano

你好,

我在Jetson Nano上使用Raspberry Pi Camera v2.1来通过gstreamer捕获图像。我有以下代码用于gstreamer-pipeline:

def gstreamer_pipeline (capture_width=3280, capture_height=2464, display_width=1280, display_height=720, framerate=21, flip_method=0) :   
    return ('nvarguscamerasrc ! ' 
    'video/x-raw(memory:NVMM), '
    'width=(int)%d, height=(int)%d, '
    'format=(string)NV12, framerate=(fraction)%d/1 ! '
    'nvvidconv flip-method=%d ! '
    'video/x-raw, width=(int)%d, height=(int)%d, format=(string)BGRx ! '
    'videoconvert ! '
    'video/x-raw, format=(string)BGR ! appsink'  % (capture_width,capture_height,framerate,flip_method,display_width,display_height))

现在,它以BGR格式输出图像,但是我需要RGB。当我尝试更改格式字符串时,出现此错误:

OpenCV Error: Unspecified error (GStreamer: unable to start pipeline
) in cvCaptureFromCAM_GStreamer, file /home/nvidia/build_opencv/opencv/modules/videoio/src/cap_gstreamer.cpp, line 887
VIDEOIO(cvCreateCapture_GStreamer (CV_CAP_GSTREAMER_FILE, filename)): raised OpenCV exception:

/home/nvidia/build_opencv/opencv/modules/videoio/src/cap_gstreamer.cpp:887: error: (-2) GStreamer: unable to start pipeline
 in function cvCaptureFromCAM_GStreamer

所以我的问题是:如何更改管道以正确输出RGB?还是我使用的硬件组合无法做到这一点?

谢谢您的提前回答!

0 个答案:

没有答案