OpenCV 在 SURF 检测后崩溃
OpenCV crash after SURF Detection
我在OpenCV中编写了一个简单的程序,该程序可以检测给定图像中的SURF特征,并在namedWindow中播放检测到的特征。
#include <iostream>
#include <opencv2corecore.hpp>
#include <opencv2highguihighgui.hpp>
#include <opencv2features2dfeatures2d.hpp>
using namespace cv;
int main(int argc,char** argv)
{
if(argc!=3)//Check cmd number of argumets
{
std::cout<<"Usage: "<<argv[0]<<" <image-file> <method>"<<std::endl;
return -1;
}
//LOAD THE SOURCE IMAGE
Mat Img = imread(argv[1],CV_LOAD_IMAGE_GRAYSCALE);
if(!Img.data)//Check correct image load
{
std::cout<<"Cannot read image file. Check file path!"<<std::endl;
return -1;
}
//COMPUTE FEATURES
SurfFeatureDetector detector;
std::vector<KeyPoint> features;
detector.detect(Img,features);
//SHOW RESULT
Mat ImgF;
drawKeypoints(Img,features,ImgF);
namedWindow("Features", CV_GUI_NORMAL);
imshow("Features",ImgF);
waitKey();
return 0;
}
一切都很好,程序做它必须做的事情。问题是当按下某个键终止程序时,会发生崩溃错误。
它
不会崩溃对我来说...但是为了让我编译你的代码,我不得不添加
#include <opencv2/nonfree/features2d.hpp>
因为 SURF 在某个时候被移到了非自由模块。
因此,我必须建议尝试最新版本(截至今天的2.4.6)。
相关文章:
- 当回溯以零开始时,如何调试崩溃
- 使用CMake检测支持的C++标准
- 内联映射初始化的动态atexit析构函数崩溃
- 执行函数时导致崩溃的变量
- 当套接字连接断开时检测C/C++Unix
- 程序崩溃并显示"std::out_of_range"错误
- C/C++预处理器是否可以检测一些编译器选项
- 操作系统如何检测进程崩溃
- 在C++/Win32中检测到进程崩溃
- Android (ART) 崩溃并显示错误 JNI 在应用程序中检测到错误:jstring 是无效的本地引用
- 我的视频流程在运行darknet.exe以进行检测对象时崩溃了
- 如何检测终止进程事件、计算机关闭和计算机崩溃
- 如何检测Poco子进程何时崩溃
- OpenCV人脸检测使计算机崩溃
- 如何找到检测到 Cuda API 错误时程序崩溃的位置:cudaMemcpy 返回 (0xb)
- OpenCV 在 SURF 检测后崩溃
- windows上的c++应用程序崩溃检测
- 一种检测进程是否崩溃(或停止)的简单方法
- 崩溃检测,日志记录和c++
- 使用C++检测进程崩溃的最佳方法是什么