30inline ::cv::Mat
montage(std::vector<std::vector<::cv::Mat>> &images) {
32 ::cv::Size ref{images[0][0].size()};
33 std::size_t max_col = 0;
35 for(
const std::vector<::cv::Mat> &v : images) {
36 for(const ::cv::Mat &i : v) {
37 if(i.size().area() < ref.area()) {
40 max_col = std::max(max_col, v.size());
44 std::vector<::cv::Mat> rows;
45 for(std::vector<::cv::Mat> &v : images) {
46 for(::cv::Mat &i : v) {
47 ::cv::resize(i, i, ref);
49 while(v.size() < max_col) {
50 v.emplace_back(ref, images[0][0].type(), ::cv::Scalar(0));
52 rows.emplace_back(v.size() * ref.width, ref.height, images[0][0].type());
53 ::cv::hconcat(v.data(), v.size(), rows.back());
55 ::cv::vconcat(rows.data(), rows.size(),
montage);
69inline ::cv::Mat
montage(std::vector<::cv::Mat> &images, std::size_t step = 0) {
70 std::vector<std::vector<::cv::Mat>> img_vector;
71 if(!
static_cast<bool>(step)) {
74 for(std::size_t i = 0; i < images.size(); i += step) {
75 img_vector.emplace_back(images.begin() +
static_cast<long>(i), std::min(images.begin() +
static_cast<long>(i + step), images.end()));
inline ::cv::Mat montage(std::vector< std::vector<::cv::Mat > > &images)
Create a montage from a matrix of images.
Definition cv-highgui.hpp:30