I'm working on receiving video stream from source. (Gazebo Simulation) First of all, I'm succesful to receive on python side, but I want to move code C++. This is python code: Python code Also I can easily add tracker to python by using:
video = Video()
frame = video.frame()
bbox = (287, 23, 86, 320)
ok = tracker.init(frame, bbox)
But when I tried to same thing on C++ it's not possible to pass easily these steps. I used this code and this is working fine: C++ Code Gstream
But I couldn't be able to use like opencv. Key code lines are:
// Main loop
while(1) {
g_main_iteration(false);
cv::Mat* frame = atomicFrame.load();
if(frame) {
cv::imshow("Frame", frame[0]);
cv::waitKey(30);
}
}
When I tried to add basic text like:
putText(frame[0], " Hello", Point(100,20), FONT_HERSHEY_SIMPLEX, 0.75, Scalar(50,170,50),2);
I'm getting hard "Segmentation fault".
I tried also use single line to receive video normal way:
VideoCapture video("udpsrc port=5600 ! application/x-rtp, payload=96 ! rtph264depay ! h264parse ! avdec_h264! decodebin ! videoconvert ! video/x-raw,format=(string)BGR ! videoconvert! appsink name=sink emit-signals=true sync=false max-buffers=1 drop=true",CAP_GSTREAMER);
But video couldn't be open.
It is not necessary anymore to convert cv::Mat* to cv::Mat. Furthermore, it's not logical.
Here is current pipeline that working without error in Gazebo Simulation:
VideoCapture video("udpsrc port=5600 ! application/x-rtp,payload=96,encoding-name=H264 ! rtpjitterbuffer mode=1 ! rtph264depay ! h264parse ! decodebin ! videoco
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.