1

我编写了一个程序,它从 gstreamer 管道读取帧,使用 opencv 库处理它们,然后写回 gstreamer 管道。

代码片段:

cv::VideoCapture cap("v4l2src ! video/x-raw, framerate=30/1, width=640, height=480, format=RGB ! videoconvert ! appsink");
if (!cap.isOpened()) {
    printf("=ERR= can't create video capture\n");
    return -1;
}

cv::VideoWriter writer;
writer.open("appsrc ! videoconvert ! x264enc noise-reduction=10000 tune=zerolatency byte-stream=true threads=4 key-int-max=15 ! mpegtsmux ! udpsink host=localhost port=9999"
            , 0, (double)15, cv::Size(640, 480), true);
if (!writer.isOpened()) {
    printf("=ERR= can't create video writer\n");
    return -1;
}

/* Read/write frames as usual */
// Mat frame
// while true
//     cap >> frame
//     process the frame
//     writer << frame

该程序在我的 ubuntu 14.04 64 位 VM 上运行良好。但是,当我尝试在 Jetson TK1 上运行它时,VideoCapture总是VideoWriter返回false.isOpened()

我使用的是 Opencv4Tegra,然后我从源代码构建了 opencv 并安装了它。两者都有同样的问题。有谁知道为什么 VideoCapture 无法在 Jetson TK1 上打开 gstreamer 管道?是因为它不适用于32位机器吗?

请注意,我使用的是 Opencv 2.4.13 和 Gstreamer 1.2 以及相机 Logitech C310。

4

0 回答 0