Hello,

Hopefully somebody on here is familiar with OpenCV....

I am using OpenCV to try to create a 20 x 2 matrix, with floating point elements, and assign the first element of the matrix to 0.6. Here is what I have tried:

int main()
{
CvMat mat = cvMat(20, 2, CV_32FC1);
mat.data.fl[0] = 0.6;

return 0;
}

This compiles well, but I get a runtime error of :

"Unhandled exception at 0x0046b0fc in TestProgram.exe: 0xC0000005: Access violation writing location 0x00000000."

It looks like it hasn't reserved space for the elements, but I would have thought this was done in the cvMat function...

What am I doing wrong?

Thanks!