Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Now I got the solution - the following code works fine:

 IplImage *pRgbImage;
  pRgbImage = cvCreateImage(cvSize(SizeX, SizeY), IPL_DEPTH_8U, 3);

  IplImage *pYuvImage;
  pYuvImage = cvCreateImage(cvSize(SizeX, SizeY), IPL_DEPTH_8U, 2);
  pYuvImage->imageData = (char*)buffer;

  cvCvtColor(pYuvImage, pRgbImage, CV_YUV2RGB);

  cvNamedWindow("MyImage");
  cvShowImage("MyImage", pRgbImage);
  cvWaitKey();
  cvDestroyWindow("MyImage");
  cvReleaseImage(&pRgbImage);

But I still have Problems converting BayerBG12:

 IplImage *pRgbImage;
  pRgbImage = cvCreateImage(cvSize(SizeX, SizeY), IPL_DEPTH_8U, 3);

  IplImage *pYuvImage;
  pBg12Image = cvCreateImage(cvSize(SizeX, SizeY), IPL_DEPTH_8U, 2);
  pBg12Image->imageData = (char*)buffer;

  cvCvtColor(pBg12Image, pRgbImage, CV_BayerBG2RGB);

  cvNamedWindow("MyImage");
  cvShowImage("MyImage", pRgbImage);
  cvWaitKey();
  cvDestroyWindow("MyImage");
  cvReleaseImage(&pRgbImage);

Any suggestions ?