我试图得到opencv的错误!说我有这个程序:
#include <opencv2\core\core.hpp>
#include <opencv2\highgui\highgui.hpp>
int main (){
cv::Mat frame;
cv::VideoCapture cap(1); // I don't have a second videoinput device!
int key = 0;
while(key !=27){
cap >> frame;
cv::imshow("frame",frame);
key = cv::waitKey(10);
}
cap.release();
return 0;
}
当我运行这个程序时,我在控制台中收到这条消息:
OpenCV Error: Assertion failed (size.width>0 && size.height>0) in unknown functi
on, file ..\..\..\opencv\modules\highgui\src\window.cpp, line 261
我的问题是如何获取此消息并将其保存在字符串中以处理我收到的每个错误!如果有可能逃脱程序崩溃!
提前致谢!