I am currently looking at computer vision and try to use Hough-Transform to find some lines. The operation it self is working, however even minimal sample code produces deallocation errors.
#include <iostream>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace std;
using namespace cv;
int main(int argc, char* argv[])
{
int size[] = {100, 100};
Mat img(1, size, CV_8U);
img = cv::Scalar(255);
vector<Vec4i> lines;
HoughLinesP(img, lines, 1, CV_PI/180, 100, 30, 5);
cout << lines.size() << endl;
}
Note that everything is working if I turn lines into *lines, create the vector on the heap and don't delete it. I cannot see any problem with the code and it is taken straight from the OpenCV example.
The exception occurs in
msvcr110d.dll!_CrtIsValidHeapPointer(const void * pUserData) Line 2036 C++
I compile and run this from VS 2012 64bit-Version, and the executable is also 64bit. OS is Windows 7, 64bit