如下代码,每次运行均出现内存错误,而且可能不同;
#include "stdafx.h"
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;
int main()
{
Mat image = imread("Sign.jpg", 1);
if (!image.data)
{
printf("Cannot read the image!");
}
imshow("Sign.jpg", image);
Mat grayImage;
cvtColor(image, grayImage, CV_BGR2GRAY);
vector<KeyPoint> keyPoints;
FAST(grayImage, keyPoints, 55);
int total = keyPoints.size();
for (int i = 0; i < total; i++)
{
circle(image, Point((int)keyPoints[i].pt.x, (int)keyPoints[i].pt.y), 5, Scalar(0, 0, 255), -1, 8, 0);
}
imshow("Corners", image);
waitKey();
return 0;
}
opencv3.2+vs2015
http://jingyan.baidu.com/article/95c9d20d4c3820ec4e7561d2.html
同学你好,我把你的代码直接运行了一下,可以运行,不知道你报错报的是哪一个?是cannot read the image?