Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Allocation error with 'cvCreateGLCM' method

Hi, I am trying to compute GLCM for an input image. I load the image, convert it to grayscale, then I invoke cvCreateGLCM method on the grayscale image. OpenCV Version: 2.4.1, vc10, x64.

const char* filePath = "C:\\input.jpg";
IplImage* inputIm = cvLoadImage(filePath);

IplImage* grayIm = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1);
cvCvtColor(inputIm, grayIm, CV_RGB2GRAY);

CvGLCM* glcm = cvCreateGLCM(resizedGray, 0);  // ERROR

I get the following error message image description

when I press 'Break', it shows where the error took place:

__forceinline void * __cdecl _heap_alloc (size_t size)


    if (_crtheap == 0) {
        _FF_MSGBANNER();    /* write run-time error banner */
        _NMSG_WRITE(_RT_CRT_NOTINIT);  /* write message */
        __crtExitProcess(255);  /* normally _exit(255) */

    return HeapAlloc(_crtheap, 0, size ? size : 1);  // <<< The error

Any ideas please?