Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ Opencv C++;在标题中使用int显示多个图像_C++_Opencv - Fatal编程技术网

C++ Opencv C++;在标题中使用int显示多个图像

C++ Opencv C++;在标题中使用int显示多个图像,c++,opencv,C++,Opencv,我想显示多个图像,我想不同的标题,有int值来自循环。我的意思是我不能这样做: int i = 7; Mat result; imshow("Result with Gaussian Filter &d X &d", i, i, result); 您有什么建议吗?您可以使用: cv::Mat result; char windowName[10]; sprintf(windowName, "%d X %d", i, i); cv::imshow(windowNa

我想显示多个图像,我想不同的标题,有int值来自循环。我的意思是我不能这样做:

  int i = 7;

  Mat result;

 imshow("Result with Gaussian Filter &d X &d", i, i, result);
您有什么建议吗?

您可以使用:

cv::Mat result;

char windowName[10];
sprintf(windowName, "%d X %d", i, i);
cv::imshow(windowName, result);

cv::Mat结果;
std::ostringstream oss;

oss
imshow
不是类似于
printf
的函数。如果您想在图像标题中包含运行时确定的整数,恐怕您必须
sprintf()
到字符缓冲区,或者生成
stringstream
。不要滥用窗口标题来获取临时/更改信息。其他函数,如imshow、createTrachbar等,都依赖于它作为键。@berak这很有趣。你能提供一些细节吗?或者某个来源,很简单,名字叫德温多(“标题1”);imshow(“标题2”);//将打开第二个窗口。@berak我的意思是其他函数如何(以及什么)依赖于窗口标题作为键?
cv::Mat result;

std::ostringstream oss;
oss << i << " X " << i;
std::string windowName = oss.str();
cv::imshow(windowName, result);