在一个OpenCV中显示不同的窗口

display different window in one OpenCV

本文关键字:显示 窗口 OpenCV 一个      更新时间:2023-10-16

由于我在opencv中的应用程序,我有三个绝缘窗口显示,我希望通过将三个放在一个窗口中并且具有不同的大小,我如何才能做到这一点铛你

在OpenCV中你只能做到这一点那就是创建一个巨大的cv::Mat它由三个图像组成并显示矩阵,这可以这样做:

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);

我认为这在OpenCV中是不可能的:http://docs.opencv.org/modules/highgui/doc/user_interface.html?highlight=show

您可以尝试手动复制单个cv::Mat中的不同图像并将其提供给imshow