I am a gstreamer new learner,maybe this question is very simple.but I can not solve it, I just want capture RGB color images but always grays . please…
#include <opencv2/opencv.hpp>
#include <opencv2/videoio.hpp>
using namespace cv;
#include
using namespace std;
int main()
{
std::string pipe = “rtspsrc location=rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4 ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvideoconvert ! appsink”;
VideoCapture cap(pipe, CAP_GSTREAMER);
if (!cap.isOpened()) {
cerr <<"VideoCapture not opened"<<endl;
exit(-1);
}
int count = 0;
while (true) {
Mat frame;
cap.read(frame);
char tmp[16];
sprintf(tmp, "pic/%d.jpg", ++count);
imwrite(tmp, frame);
printf("-----------------%d\n", count);
}
return 0;
}