placing two images side by side, opencv 2.3, c++
opencv
Solution
There is a very simple way of displaying two images side by side. The following function can be used which is provided by opencv.
Mat image1, image2;
hconcat(image1,image2,image1);//Syntax-> hconcat(source1,source2,destination);
This function can also be used to copy a set of columns from an image to another image.
Mat image;
Mat columns=image.colRange(20,30);
hconcat(image,columns,image);
Problem
I #m reading two images and want to get third one which is just combination of two. img_object and img_scene don't have same size. ``` int main( int argc, char** argv ) Mat combine; Mat img_object = imread( object_filename, CV_LOAD_IMAGE_GRAYSCALE ); Mat img_scene = imread( scene_filename , CV_LOAD_IMAGE_GRAYSCALE ); if( !img_object.data || !img_scene.data ) { std::cout<< " --(!) Error reading images " << std::endl; return -1; } namedWindow( "Display window oject", 0 );// Create a window for display. namedWindow( "Display window scene ", 0 ); namedWindow( "Display window combine ", 0 ); imshow( "Display window oject", img_object ); imshow( "Display window scene", img_scene ); imshow( "Display window scene", combine ); waitKey(0); return 0; } ```