display different window in one OpenCV

as a result for my application in opencv I have three insulated window displayed I want that be more beautiful by putting the three in one window and with different sizes how can i do it thunk you

Upvotes: 1

Views: 70

Answers (2)

Enigma
Enigma

Reputation: 1717

I think this is not possible within OpenCV: http://docs.opencv.org/modules/highgui/doc/user_interface.html?highlight=show#

You could try to manually copy the different images in a single cv::Mat and feed that to imshow

Upvotes: 0

GPPK
GPPK

Reputation: 6666

You can only do this one way in OpenCV and that is creating one giant cv::Mat that is composed of the three images and imshowing that matrix, this can be done like this:

cv::Size s1 = img1.size();
cv::Size s2 = img2.size();
cv::Size s3 = img3.size();

cv::Mat output(s1.height, s1.width + s2.width + s3.width, CV_MAT_TYPE); // put in the type of your mat

cv::Mat help1(output, cv::Rect(0,0, s1.width, s1.height);
cv::Mat help2(output, cv::Rect(s1.width, 0, s2.width, s2.height);
cv::Mat help3(output, cv::Rect(s1.width + s2.width, 0, s3.width, s3.height);

img1.copyTo(help1);
img2.copyTo(help2);
img3.copyTo(help3);

cv::imshow("Output", output);

Upvotes: 1

Related Questions