Ask Your Question

Jerry Yu's profile - activity

2019-02-02 21:18:58 -0600 received badge  Popular Question (source)
2012-09-13 00:57:20 -0600 received badge  Student (source)
2012-09-13 00:42:17 -0600 received badge  Editor (source)
2012-09-13 00:35:18 -0600 asked a question 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.

2012-09-12 23:31:21 -0600 commented question Copying an SVM

I also meet the same case:" OpenCV Error: Assertion failed (udata < (uchar)ptr && ((uchar)ptr - udata) <=(ptrdiff_t)(sizeof(void*)+16)) in unknown function." If you fix it,please let me know how.