1 #include <opencv2/opencv.hpp>
63 template <
int PixelFormat>
64 void showManyImages(
const string &title,
const std::vector<cv::Mat> &images) {
66 int n_images = images.size();
84 printf(
"Number of arguments too small....\n");
86 }
else if (n_images > 14) {
87 printf(
"Number of arguments too large, can only handle maximally 12 images at a time ...\n");
94 else if (n_images == 1) {
97 }
else if (n_images == 2) {
101 }
else if (n_images == 3 || n_images == 4) {
105 }
else if (n_images == 5 || n_images == 6) {
109 }
else if (n_images == 7 || n_images == 8) {
120 Mat DispImage = Mat::zeros(Size(100 + size * w, 60 + size * h), PixelFormat);
123 for (i = 0, m = 20, n = 20; i < n_images; i++, m += (20 + size)) {
127 if (images[i].empty()) {
128 printf(
"Invalid arguments");
137 max = (x > y) ? x : y;
140 scale = (float)((
float)max / float(size));
143 if (i % w == 0 && m != 20) {
150 Rect ROI(m, n, (
int)(
float(x) / scale), (
int)(
float(y) / scale));
152 resize(images[i], temp, Size(ROI.width, ROI.height));
153 temp.copyTo(DispImage(ROI));
157 imshow(title, DispImage);