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(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 - 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.