Untitled
unknown
plain_text
a year ago
985 B
3
Indexable
#include <iostream> #include <opencv2/opencv.hpp> int main() { // Load the four small images cv::Mat image1 = cv::imread("image1.jpg"); cv::Mat image2 = cv::imread("image2.jpg"); cv::Mat image3 = cv::imread("image3.jpg"); cv::Mat image4 = cv::imread("image4.jpg"); // Create a large image to store the combined images cv::Mat largeImage(image1.rows * 2, image1.cols * 2, CV_8UC3); // Copy the four small images to the large image image1.copyTo(largeImage(cv::Rect(0, 0, image1.cols, image1.rows))); image2.copyTo(largeImage(cv::Rect(image1.cols, 0, image2.cols, image2.rows))); image3.copyTo(largeImage(cv::Rect(0, image1.rows, image3.cols, image3.rows))); image4.copyTo(largeImage(cv::Rect(image1.cols, image1.rows, image4.cols, image4.rows))); // Save the large image cv::imwrite("large_image.jpg", largeImage); // Display the large image cv::imshow("Large Image", largeImage); cv::waitKey(0); return 0; }
Editor is loading...
Leave a Comment