C++ Yocto Linux中带Opencv的Gstreamer
我有两个Yocto构建在不同的处理器上运行,我正在尝试用GStreamer编写一个OpenCV代码,其中一个将发送数据包,另一个将接收数据包。我面临的问题是,在接收器脚本中,程序被“VideoCapture”功能卡住,无法进一步执行。接收器与HDMI屏幕相连,在运行目标文件后,监视器上没有变化。下面我附上代码C++ Yocto Linux中带Opencv的Gstreamer,c++,linux,opencv,gstreamer,yocto,C++,Linux,Opencv,Gstreamer,Yocto,我有两个Yocto构建在不同的处理器上运行,我正在尝试用GStreamer编写一个OpenCV代码,其中一个将发送数据包,另一个将接收数据包。我面临的问题是,在接收器脚本中,程序被“VideoCapture”功能卡住,无法进一步执行。接收器与HDMI屏幕相连,在运行目标文件后,监视器上没有变化。下面我附上代码 #include <iostream> #include <opencv2/core.hpp> #include <opencv2/highgui.hpp&g
#include <iostream>
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
using namespace std;
using namespace cv;
int main(void)
{
cout<<"in main function"<<endl;
const char* gstrec="udpsrc port=5000 ! application/x-rtp,media=video,encoding-name=H264,payload=96,clock-rate=90000,framerate=30/1 ! \
rtpjitterbuffer latency=10 drop-on-latency=TRUE ! rtph264depay ! video/x-h264 ! h264parse ! decodebin ! video/x-raw,\
format=NV12 ! videoconvert ! video/x-raw,format=BGR ! appsink";
cout<<"Gstreamer script running"<<endl;
VideoCapture cap(gstrec,CAP_GSTREAMER);
cout<<"You are out of VideoCapture function"<<endl;
if(!cap.isOpened())
{
cout<<"VideoCapture not opened"<<endl;
exit(-1);
}
cout<<"The videocapture is opened"<<endl;
Mat frame;
for(;;) {
cap.read(frame);
if(frame.empty())
break;
cout<<"In while loop"<<endl;
imshow("Receiver", frame);
if(waitKey(1) == 'r')
break;
}
destroyWindow("Receiver");
return 0;
}
#包括
#包括
#包括
使用名称空间std;
使用名称空间cv;
内部主(空)
{
库特