Opencv .exe不断崩溃,打开CV
我一直在使用这个简单的代码时遇到问题,它本应打开我的相机,但Opencv .exe不断崩溃,打开CV,opencv,compilation,crash,Opencv,Compilation,Crash,我一直在使用这个简单的代码时遇到问题,它本应打开我的相机,但.exe一直崩溃。你知道我该怎么办吗 #include <opencv2/opencv.hpp> #include <opencv2/highgui/highgui.hpp> #include <iostream> using namespace cv; using namespace std; int main( int argc, const char** argv ) { Mat i
.exe
一直崩溃。你知道我该怎么办吗
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main( int argc, const char** argv )
{
Mat image;
VideoCapture cap(0);
if(!cap.isOpened()) {
cerr << "No camera detected on this system" << endl;
return -1;
}
while(true) {
cap >> image;
if(image.empty()) {
cerr << "Frame invalid and skipped!" << endl;
continue;
}
imshow("test", image);
waitKey(5);
}
return 0;
}
#包括
#包括
#包括
使用名称空间cv;
使用名称空间std;
int main(int argc,常量字符**argv)
{
Mat图像;
视频捕获上限(0);
如果(!cap.isOpened()){
cerr图像;
if(image.empty()){
cerr定义“崩溃”并提供更多详细信息。产生任何错误消息?未捕获异常(使用调试器).什么平台?什么OpenCV版本?等等…gcc 5.1.0、OpenCV 3.1.0确保apl可以使用所有必要的DLL。在每个代码行之前添加一个std::cout以查看崩溃的位置。开始时以调试模式运行,而不是发布。调试模式更有助于查找问题。并分步运行应用程序,以便知道是哪一个版本h行导致问题。它是在调试模式下运行的,未显示任何问题