How to tile multiple live camera feeds in one window
I have live feeds from four GigE cameras. Is it possible to display all the four feeds in a single window.
I have live feeds from four GigE cameras. Is it possible to display all the four feeds in a single window.
it's possible of course
Suppose you are grabbing in cv::Mat m1,m2,m3,m4;
that have same size and type
//define the tiled image so that it can contains 4 images
Mat tile
tile = Mat(2*m1.size(),m1.type());
//define 4 ROI where the single images will be copied to
Rect r1,r2,r3,r4;
r1 = Rect(0,0,m1.size()); // top left
r2 = Rect(m1.cols,0,m1.size()); // top right
r3 = Rect(0,m1.rows,m1.size()); // bottom left
r4 = Rect(m1.cols,m1.rows,m1.size()); // bottom right
// Transfer the image into tiled one
m1.copyTo(tile(r1)); m2.copyTo(tile(r2));
m3.copyTo(tile(r3)); m4.copyTo(tile(r4));
cv::imshow("Tiled images", tile);
OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file /home/valuser/opencv-2.4.13/modules/core/src/matrix.cpp, line 323
terminate called after throwing an instance of 'cv::Exception'
what(): /home/valuser/opencv-2.4.13/modules/core/src/matrix.cpp:323: error: (-215) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function Mat
Got above error for belo tile setting. (img size = 700x400)
r1 = Rect(0,0,2700, 2400)
r2 = Rect(original_resized.cols-1,0,2700, 2400);
r3 = Rect(0,original_resized.rows-1,2700, 2400);
r4 = Rect(original_resized.cols-1,original_resized.rows-1,2700, 2400
Asked: 2016-05-30 05:01:56 -0600
Seen: 1,032 times
Last updated: May 30 '16