Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Visual Studio 2012 and RtlFreeHeap error

HI All, I have a small issue with VS2012 and the memory clean up. I'm able to get frames from my webcam and apply some filters like Canny, so the installation should be fine, but when I try to use the HoughLinesP I got an exception at the end of the program stating

HEAP[OpenCVTest01.exe]: Invalid address specified to RtlFreeHeap( 00000000003E0000, 00000000027A8080 )
OpenCVTest01.exe has triggered a breakpoint.

I have googled and this error seams to be related to a discrepancy between the CRL used to build the openCV and my program, but using the dumpbin, it doesn't seam to be the case, they are both using the multi-threaded version.

that's the code I'm executing

#include "stdafx.h"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"

using namespace cv;
int _tmain(int, char**)
{
  VideoCapture cap(1); // my webcam is not at zero
  if(!cap.isOpened()) return -1;

  Mat frame, edges;
  vector<Vec4i> lines;
  namedWindow("Frame",1);

  for(;;)
  {
    cap >> frame;
    cvtColor(frame, edges, CV_BGR2GRAY);

    GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);
    Canny(edges, edges, 0, 30, 3);

    HoughLinesP(edges, lines, 1, CV_PI/180, 50, 50, 10 );
    imshow("Frame", frame);
    if(waitKey(30) >= 0) break;
  }
  return 0;
}

the exception is thrown after the for loop during the cleanup process. If I comment the HoughLinesP call, everything is working fine.

Can some please point me in the right direction?

Thanks.