1
cv::Mat tl = cv::imread(tl_path);
cv::Mat tr = cv::imread(tr_path);
cv::Mat bl = cv::imread(bl_path);
cv::Mat br = cv::imread(br_path);

cv::Mat newTile = cv::Mat(tl.rows * 2, tl.cols * 2, tl.type());
newTile(cv::Rect(0, 0, tl.cols, tl.rows)) = tl;
newTile(cv::Rect(tl.cols, 0, tl.cols, tl.rows)) = tr;
newTile(cv::Rect(0, tl.rows, tl.cols, tl.rows)) = bl;
newTile(cv::Rect(tl.cols, tl.rows, tl.cols, tl.rows)) = br;

cv::resize(newTile, newTile, tl.size());

cv::imwrite(output_path,newTile);

I wrote the above code to combine 4 images into one, but the result is just a black image. What am i missing? All of the 4 images are of same type

herohuyongtao
  • 49,413
  • 29
  • 133
  • 174
Poul K. Sørensen
  • 16,950
  • 21
  • 126
  • 283

0 Answers0