19,469
社区成员
发帖
与我相关
我的任务
分享
#include "opencv2\core\mat.hpp";
#include "opencv2\imgcodecs.hpp";
#include "opencv2\core\cvstd.hpp";
#include "opencv2\highgui.hpp";
using namespace cv;
int main(int argc,char** argv)
{
printf("start...\n");
String imgName("D:\\Test.jpg");
printf("%s\n",imgName.c_str());
Mat I0(imread(imgName,ImreadModes::IMREAD_GRAYSCALE));
if(I0.empty())
{
printf("Failed to load image I0...\n");
return -1;
}
namedWindow("Test",WINDOW_AUTOSIZE);
printf("before imshow...\n");
imshow("Test",I0);
printf("after imshow...\n");
while(1)
{
if(waitKey(10)==27)
break;
}
return 0;
}