[英]OpenCv image is not getting displayed
請查看以下代碼
#include <opencv2\core\core.hpp>
#include <opencv2\highgui\highgui.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;
}
當我運行此代碼時,我沒有顯示圖像。 而是顯示空白圖像。 這是為什么? 請幫忙。
你需要刷新窗口。 系統(“暫停”)不這樣做。 opencv等價物是waitKey(0);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.