Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV Error:Assertion failed alloc.cpp,line 76

I try the following code using OpenCV 2.3.1 and it fails when attempting to return in main(). typedef struct window { int height; int width; double scale; struct window next;
}window; int main() {
CvSVM svm=CvSVM(); svm.load("SVM_DATA2.xml"); IplImage *p=cvLoadImage("C:\1\result2\image_00050.png",-1); struct window *head,
q; head=descriptor(p,1.1,svm); for(q=head;q!=NULL;q=q->next) {
cvRectangle(p, cvPoint(q->width,q->height), cvPoint(q->width+cvFloor(64q->scale),q->height+cvFloor(128q->scale)), cvScalar(0,0,255), 1);
}
cvNamedWindow("svm", CV_WINDOW_AUTOSIZE); cvMoveWindow("svm", 100, 100); cvShowImage("svm", p ); cvWaitKey(0); cvReleaseImage(&p ); return 0; } and gives the message (VS2008 Windows 7) OpenCV Error: Assertion failed (udata < (uchar)ptr && ((uchar)ptr - udata) <= (ptrdiff_t)(sizeof(void*)+16)) in unknown function, file ......\src\opencv\mod ules\core\src\alloc.cpp, line 76. So,I tried some break point,when i come to the bottom line" return 0" it shows cv::Exception. I am a freshman and will waiting for any advice.

OpenCV Error:Assertion failed alloc.cpp,line 76

I try the following code using OpenCV 2.3.1 and it fails when attempting to return in main(). main().

typedef struct window { {

int height;
 int width;
 double scale;
 struct window next; 
}window;
*next;

}window;

int main() {

    CvSVM svm=CvSVM();
     svm.load("SVM_DATA2.xml");
    IplImage *p=cvLoadImage("C:\1\result2\image_00050.png",-1);
*p=cvLoadImage("C:\\1\\result2\\image_00050.png",-1);
    struct window *head,q;
*head,*q;
    head=descriptor(p,1.1,svm);
    for(q=head;q!=NULL;q=q->next)
     { 
cvRectangle(p, cvPoint(q->width,q->height), cvPoint(q->width+cvFloor(64q->scale),q->height+cvFloor(128q->scale)), cvPoint(q->width+cvFloor(64*q->scale),q->height+cvFloor(128*q->scale)), cvScalar(0,0,255), 1);
}
cvNamedWindow("svm", CV_WINDOW_AUTOSIZE); cvMoveWindow("svm", 100, 100); cvShowImage("svm", p ); cvWaitKey(0); cvReleaseImage(&p ); return 0; }

}

and gives the message (VS2008 Windows 7) 7)

OpenCV Error: Assertion failed (udata < (uchar)ptr && ((uchar)ptr - udata) <= (ptrdiff_t)(sizeof(void*)+16)) in unknown function, file ......\src\opencv\mod ules\core\src\alloc.cpp, line 76. 76.

So,I tried some break point,when i come to the bottom line" return 0" it shows cv::Exception. I am a freshman and will waiting for any advice.

click to hide/show revision 3
formatting

OpenCV Error:Assertion failed alloc.cpp,line 76

I try the following code using OpenCV 2.3.1 2.3.1 and it fails when attempting to return in main().

typedef struct window
{

{
int height;
 int width;
 double scale;
 struct window *next;

}window;

*next; } window; int main() {

  CvSVM svm=CvSVM();
 svm.load("SVM_DATA2.xml");
  IplImage *p=cvLoadImage("C:\\1\\result2\\image_00050.png",-1);
  struct window *head,*q;
 head=descriptor(p,1.1,svm);
 for(q=head;q!=NULL;q=q->next)
 {
  cvRectangle(p, cvPoint(q->width,q->height), cvPoint(q->width+cvFloor(64*q->scale),q->height+cvFloor(128*q->scale)), cvScalar(0,0,255), 1);
 }
  cvNamedWindow("svm", CV_WINDOW_AUTOSIZE);
  cvMoveWindow("svm", 100, 100);
 cvShowImage("svm", p );
 cvWaitKey(0);
  cvReleaseImage(&p );
 return 0;
}

}

and gives the message (VS2008 Windows 7)

OpenCV Error: Assertion failed (udata < (uchar)ptr (uchar*)ptr && ((uchar)ptr ((uchar*)ptr - udata) <= (ptrdiff_t)(sizeof(void*)+16)) in unknown function, file ......\src\opencv\mod ..\..\..\src\opencv\mod ules\core\src\alloc.cpp, line 76.

So,I tried some break point,when i come to the bottom line" return 0" it shows cv::Exception. I am a freshman and will waiting for any advice.