代码如下,主要是测试opencv内库有没有安装好,结果显示不出来。
#include "stdio.h"
#include<iostream>
#include<opencv2/opencv.hpp>
//#include <opencv2/core/core.hpp>
//#include <opencv2/highgui/highgui.hpp>
//#include<opencv2/highgui/highgui_c.h>
using namespace cv;
int main()
{
Mat img = imread("D:\\VS\\code\\111\\jiandan1.jpg"); //E:\\1.bmp D:\\VS\\code\\111
namedWindow("opencv");
imshow("opencv", img);
waitKey(0);
return 0;
}
运行结果表示:
OpenCV(4.5.0) Error: Assertion failed (size.width>0 && size.height>0) in cv::imshow, file C:\build\master_winpack-build-win64-vc15\opencv\modules\highgui\src\window.cpp, line 376
OpenCV: terminate handler is called! The last OpenCV error is:
OpenCV(4.5.0) Error: Assertion failed (size.width>0 && size.height>0) in cv::imshow, file C:\build\master_winpack-build-win64-vc15\opencv\modules\highgui\src\window.cpp, line 376
调试显示异常:
0x00007FF8BD564ED9 处(位于 111.exe 中)有未经处理的异常: Microsoft C++ 异常: cv::Exception,位于内存位置 0x0000008C3CD9F240 处。