"merge images opencv c++" Code Answer's

You're definitely familiar with the best coding language C++ that developers use to develop their projects and they get all their queries like "merge images opencv c++" answered properly. Developers are finding an appropriate answer about merge images opencv c++ related to the C++ coding language. By visiting this online portal developers get answers concerning C++ codes question like merge images opencv c++. Enter your desired code related query in the search bar and get every piece of information about C++ code related question on merge images opencv c++. 

merge images opencv c++

By Depressed DugongDepressed Dugong on Jan 11, 2021
#include <opencv2\opencv.hpp>
using namespace cv;

int main()
{
    // Load images
    Mat3b img1 = imread("path_to_image_1");
    Mat3b img2 = imread("path_to_image_2");

    // Get dimension of final image
    int rows = max(img1.rows, img2.rows);
    int cols = img1.cols + img2.cols;

    // Create a black image
    Mat3b res(rows, cols, Vec3b(0,0,0));

    // Copy images in correct position
    img1.copyTo(res(Rect(0, 0, img1.cols, img1.rows)));
    img2.copyTo(res(Rect(img1.cols, 0, img2.cols, img2.rows)));

    // Show result
    imshow("Img 1", img1);
    imshow("Img 2", img2);
    imshow("Result", res);
    waitKey();

    return 0;
}

Source: stackoverflow.com

Add Comment

1

All those coders who are working on the C++ based application and are stuck on merge images opencv c++ can get a collection of related answers to their query. Programmers need to enter their query on merge images opencv c++ related to C++ code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about merge images opencv c++ for the programmers working on C++ code while coding their module. Coders are also allowed to rectify already present answers of merge images opencv c++ while working on the C++ language code. Developers can add up suggestions if they deem fit any other answer relating to "merge images opencv c++". Visit this developer's friendly online web community, CodeProZone, and get your queries like merge images opencv c++ resolved professionally and stay updated to the latest C++ updates. 

C++ answers related to "merge images opencv c++"

View All C++ queries

C++ queries related to "merge images opencv c++"

Browse Other Code Languages

CodeProZone