Convert PByte to Mat
Hi, I am using PS3 camera with opencv it works with PByte data type.Gives PByte as frame result.In SDK samples they use IplImage.I want use Mat instead IplImage.But i cant convert PByte to Mat.How can i convert PByte to Mat ? Example In SDK
IplImage *pCapImage;
PBYTE pCapBuffer = NULL;
cvGetImageRawData(pCapImage, &pCapBuffer);
while(_running)
{
cvGetImageRawData(pCapImage, &pCapBuffer);
CLEyeCameraGetFrame(_cam, pCapBuffer, (i==0)?2000:0);
}
//Function from SDK
IMPORT(bool) CLEyeCameraGetFrame(CLEyeCameraInstance cam, PBYTE pData, int waitTimeout = 2000);
//MyCode //I use 2 camera.
cv::Mat pCapImage[2];
PBYTE pCapBuffer = NULL;
while(_running){
for (int i = 0; i < 2; i++)
{
//trying convert
pCapImage[i] = cv::Mat (cvSize(w, h), 4, &pCapBuffer,IPL_DEPTH_8U).clone();
CLEyeCameraGetFrame(_cam[i], pCapBuffer);
}
Mat pCapImageMatL = pCapImage[0];
Mat pCapImageMatR = pCapImage[1];
imshow(_windowNameL, pCapImageMatL);
imshow(_windowNameR, pCapImageMatR);
}