handling camera buffer
In my project i already have camera output in a buffer
ProcessFrames(unsigned char *RefFrame,unsigned char *CurrentFrame, int width,int height)
{
IplImage *ReferenceImage = cvCreateImageHeader(cvSize(width,height),IPL_DEPTH_8U,1);
IplImage *CurrentImage = cvCreateImageHeader(cvSize(width,height),IPL_DEPTH_8U,1);
IplImage *ResultImage = cvCreateImageHeader(cvSize(width,height),IPL_DEPTH_8U,1);
// my camera input is Grey so i keep all at same depth
cvSetData( ReferenceImage, RefFrame, width );
cvSetData( CurrentImage, CurrentFrame, width ); // fine until here
cvAbsDiff(ReferenceImage, CurrentImage, ResultImage);
// here is the culprit for crash
// can somebody point what is going wrong here
//finally i do this
cvReleaseImageHeader(&ReferenceImage);
cvReleaseImageHeader(&CurrentImage);
cvReleaseImageHeader(&ResultImage);
}
after core dump i get the message
OpenCV Error: Bad argument (Unknown array type) in cvarrToMat
Downloads/opencv-2.4.7/modules/core/src/matrix.cpp, line 698
terminate called after throwing an instance of 'cv::Exception'
what(): Downloads/opencv-2.4.7/modules/core/src/matrix.cpp:698: error: (-5) Unknown array type in function cvarrToMat