Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Assertion failed in Blur/LocateROI

Hi,

I am trying to grab images off a sCMOS camera and process them on the fly. As the title says I am getting an assertion failed error when invoking blur (I have also seen this with several other functions)

The error seems to be in line 714 of matrix.cpp (I am using the precompiled 2.4.10 release):

void Mat::locateROI( Size& wholeSize, Point& ofs ) const
...
       CV_DbgAssert( data == datastart + ofs.y*step[0] + ofs.x*esz );

I suspect this is related to the roundabout way I am allocating memory.

During camera setup I declare a buffer that is big enough for 16 images.

*UserBufferBlock = (WORD*)malloc(*BufSize*NBUF);
for (int i=0;i<NBUF;i++)
    UserBuffers[i] = UserBufferBlock + (*BufSize*i)/2;// /2 because it counts in words and everybody else counts in bytes.

The camera SDK then dumps consecutive images into UserBuffers[i]

I transfer the images to Mat structures, by modifying the Mat.data pointer to point to UserBuffers[i], the image returned by the camera:

#define NFRAMES 1
#define MFRAMES 16

Mat Frame[NFRAMES*MFRAMES];

//width =1120; Height=500
for (int j = 0; j<MFRAMES; j++)
    for (int i = 0; i<NFRAMES; i++)
            Frame[k] = Mat(Height,Width,CV_16UC1);

Result = Take_Picture(&Frame[ii].data, &BufferID[ii]);

Any suggestions on how to fix this? guy

Assertion failed in Blur/LocateROI

Hi,

I am trying to grab images off a sCMOS camera and process them on the fly. As the title says I am getting an assertion failed error when invoking blur (I have also seen this with several other functions)

The error seems to be in line 714 of matrix.cpp (I am using the precompiled 2.4.10 release):

void Mat::locateROI( Size& wholeSize, Point& ofs ) const
...
       CV_DbgAssert( data == datastart + ofs.y*step[0] + ofs.x*esz );

I suspect this is related to the roundabout way I am allocating memory.

During camera setup I declare a buffer that is big enough for 16 images.

*UserBufferBlock = (WORD*)malloc(*BufSize*NBUF);
for (int i=0;i<NBUF;i++)
    UserBuffers[i] = UserBufferBlock + (*BufSize*i)/2;// /2 because it counts in words and everybody else counts in bytes.

The camera SDK then dumps consecutive images into UserBuffers[i]

I transfer the images to Mat structures, by modifying the Mat.data pointer to point to UserBuffers[i], the image returned by the camera:

#define NFRAMES 1
#define MFRAMES 16

Mat Frame[NFRAMES*MFRAMES];

//width =1120; Height=500
for (int j = 0; j<MFRAMES; j++)
    for (int i = 0; i<NFRAMES; i++)
    {
            Frame[k] = Mat(Height,Width,CV_16UC1);
                     k++;
    }
Result = Take_Picture(&Frame[ii].data, &BufferID[ii]);

Any suggestions on how to fix this? guy