Sencis
December 21, 2021, 10:04am
1
I have changed the default example opencvcap, but it still only displayed one camera? How can I make output of two cameras right and left in one window cv cap?
" gst-launch-1.0 max-buffers=1 drop=true sync=false"
" v4l2src device=/dev/video"+ std::to_string(device_1) + " !"
" video/x-raw,"
" width=(int)" + std::to_string(capture_width) + ","
" height=(int)" + std::to_string(capture_height) + ","
" format=GRAY8,"
" framerate=(fraction)" + std::to_string(framerate) +"/1 !"
" appsink"
" v4l2src device=/dev/video"+ std::to_string(device_2) + " !"
" video/x-raw,"
" width=(int)" + std::to_string(capture_width) + ","
" height=(int)" + std::to_string(capture_height) + ","
" format=GRAY8,"
" framerate=(fraction)" + std::to_string(framerate) +"/1 !"
" appsink";
kbarni
December 21, 2021, 5:39pm
2
Why don’t you use the included VideoCapture class?
cv::VideoCapture camA(0),camB(1);
if((!camA.isOpened)||(!camB.isOpened)) {
std::cout<<"Camera error"<<std::endl;
return;
}
cv::Mat frame1,frameB,frame;
camA>>frameA;
camB>>frameB;
If you want to show them in one window, just concatenate them:
hconcat(frameA,frameB,frame);
imshow("Frame",frame);
Normally your cameras are managed by V4L2 and have the addresses /dev/video0 and /dev/video1.
Sencis
December 24, 2021, 10:02pm
4
It seems this is what I was looking for.
" gst-launch-1.0 -e"
" v4l2src device=/dev/video0 ! videorate !"
" video/x-raw,"
" width=(int)640,"
" height=(int)400,"
" format=GRAY8,"
" framerate=(fraction)50/1 !"
" m.sink_0"
" v4l2src device=/dev/video2 ! videorate !"
" video/x-raw,"
" width=(int)640,"
" height=(int)400,"
" format=GRAY8,"
" framerate=(fraction)50/1 !"
" m.sink_1"
" glvideomixer name=m sink_1::xpos=640 ! video/x-raw, width=(int)1280, height=(int)400, format=GRAY8, framerate=(fraction)50/1 !"
" appsink max-buffers=1 drop=true sync=false";