Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

convert char** to cv::Mat

Hi to everyone! I am trying to convert raw image data from my IP camera to cv::Mat. But can't do it properly. My IP camera use it's own library to retrieve images. This function looks like

GetVideoData(hwnd, (char**)&Frame, &dataLen, videofmt,&mediaSpeed);

Frame has a data buffer of type char data[0] in it's struct; Can anybody help me to find out how to convert Frame->data to cv::Mat?

I tried to do it like:

cv::Mat cameraFrame = cv::Mat(h, w, CV_8UC1, Frame->data);

And after i do some processing on this cameraFrame like facerecognition stuff and finally i need to convert proccessed cameraFrame Mat back to char, but dont't know how to do it? Mat uses uchar under the hood.

convert char** to cv::Mat

Hi to everyone! I am trying to convert raw image data from my IP camera to cv::Mat. But can't do it properly. My IP camera use it's own library to retrieve images. This function looks like

GetVideoData(hwnd, (char**)&Frame, &dataLen, videofmt,&mediaSpeed);

Frame has a data buffer of type char data[0] in it's struct; Can anybody help me to find out how to convert Frame->data to cv::Mat?

I tried to do it like:

cv::Mat cameraFrame = cv::Mat(h, w, CV_8UC1, Frame->data);

And after But when i do some processing on this cameraFrame am trying to show it with imshow("name",cameraFrame); it looks like facerecognition stuff gray and finally i need to convert proccessed cameraFrame Mat back to char, but dont't know how to do it? Mat uses uchar under the hood.very pure image.. C:\fakepath\Screen.JPG