View Full Version : OpenCV, problem to pass the video buffer

May 24, 2013, 20:31:59

I actually tried to pass the video buffer from IC Imaging source library to my open CV code, but it doesn't work.

This is what I did :

char* charData = new char;
*charData = 'h';
BYTE* byteData = m_pBuffer->getPtr();
*charData = *byteData;
p_imgOriginal->imageData = charData; // IplImage *p_imgOriginal = cvCreateImageHeader(size640x480, depth,channels);

When I execute this, my program crash.

Thanks in advance for your reply

Tim Cassens
June 4, 2013, 15:56:15
If you know that the buffer pointed to by m_pBuffer->getPtr() wont change (because you called lock() on it), you can simply use

p_imgOriginal->imageData = m_pBuffer->getPtr()

provided that the data type of the image matches that of the image buffer.