OpenCv图像没有显示
OpenCv image is not getting displayed
请看下面的代码
#include <opencv2corecore.hpp>
#include <opencv2highguihighgui.hpp>
#include <iostream>
using namespace std;
using namespace cv;
int main()
{
Mat image;
try
{
image = imread("C:/Users/Public/Pictures/Sample Pictures/Chrysanthemum.jpg");
if(!image.data)
{
throw 1;
}
cout << "Height: " << image.size().height << " Width: " << image.size().width << endl;
}
catch(int error)
{
cout << "This message does not exists" << endl;
exit(0);
}
namedWindow("Image 1");
imshow("Image 1",image);
system("pause");
return 0;
}
当我运行这段代码时,我没有得到图像显示。相反,将显示一个空白图像。为什么呢?请帮助。
您需要让窗口刷新。系统("pause")不执行此操作。与opencv等价的是waitKey (0);
相关文章:
- C++,OpenCV,尝试显示图像时"OpenCV(4.3.0) Error: Assertion failed (size.width>0 && size.height>0)"此错误
- C++射线示踪剂ppm表示没有足够的数据来显示图像
- 我在 OpenGL 中显示图像时遇到问题
- 无法在 Opencv 中显示图像导致内存位置
- 从C++调用网络摄像头并在 Python 中显示图像
- C++列出屏幕以在第二台显示器中显示图像
- 如何用QT显示图像
- 如何在 QGraphicsView 中显示图像
- C++/openCV - 为什么显示图像会产生 Linux 分割错误?(打开CV错误?
- 在C 中显示图像及其元数据
- C++显示图像并将其保持到下一张图像的最佳方法
- 如何使用SDL_surface在用户定义的矩形上显示图像?
- 如何使用QVector的QPixmap显示图像?
- 如何在任何使用 Opencv 的计算机上显示图像
- 使用 qt 和 opengl、定时精度和垂直同步问题、c++ 显示图像
- QLabel像视频一样显示图像
- 使用 c++ 显示图像
- Qt表查看单元格中的显示图像并在单击时获取路径
- 在Visual C 控制台应用程序中显示图像
- 如何使用Createbsection显示图像