OpenCv, color video to gray
Hi i'm trying to convert a color video to gray in opencv. To start of i have my original image stream :

`IplImage *depthimg = cvCreateImageHeader(cvSize(640,480), 8, 3);`
(
Which i can display and see perfectly)

I also created another one for the gray stream:

     IplImage *graydepthimg = cvCreateImageHeader(cvSize(640,480), 8, 3);


Now in the main in a while i have this

     cvCvtColor(depthimg,graydepthimg,CV_BGR2GRAY);


But i get this exception :

    OpenCV Error: Bad argument (Unknown array type) in cvarrToMat, file /Users/olivierjanssens/source/OpenCV-2.3.1/modules/core/src/matrix.cpp,


What am i doing wrong ?

Thank you in advance !
OpenCv, color video to gray
===

Hi i'm trying to convert a color video to gray in opencv. To start of i have my original image stream :

`IplImage *depthimg = cvCreateImageHeader(cvSize(640,480), 8, 3);`
(
Which i can display and see perfectly)

I also created another one for the gray stream:

     IplImage *graydepthimg = cvCreateImageHeader(cvSize(640,480), 8, 3);


Now in the main in a while i have this

     cvCvtColor(depthimg,graydepthimg,CV_BGR2GRAY);


But i get this exception :

    OpenCV Error: Bad argument (Unknown array type) in cvarrToMat, file /Users/olivierjanssens/source/OpenCV-2.3.1/modules/core/src/matrix.cpp,


What am i doing wrong ?

Thank you in advance !