0
我有一個問題,將數據複製到cvMat。我也嘗試創建一個結構,但它不起作用。我得到的輸出是黑色圖像。 這是相關代碼:rgb 8位從其他數據cvMat
CvMat* rgbMat = cvCreateMat(480,640,CV_8UC3);
IplImage *kinectRgbImage;
RgbImage = cvCreateImage(cvSize(640,480),8,3);
...stuff...
//from pImageMap you can access to the blue,red,green color parts of the image
for (int y=0; y<XN_VGA_Y_RES; y++)
{
for(int x=0;x<XN_VGA_X_RES;x++)
{
rgbPointer[y * XN_VGA_X_RES + x ].blue= pImageMap[y * XN_VGA_X_RES + x].nBlue;
rgbPointer[y * XN_VGA_X_RES + x ].green= pImageMap[y * XN_VGA_X_RES + x].nGreen;
rgbPointer[y * XN_VGA_X_RES + x ].red= pImageMap[y * XN_VGA_X_RES + x].nRed;
}}
cvGetImage(rgbPointer,RgbImage);
cvShowImage("Rgb", RgbImage);
我想也將數據與
rgbMat->data.s[ 3 * (y * XN_VGA_X_RES + x) + 0 ] = pImageMap[ 3 * (y * XN_VGA_X_RES + x) + 0 ] .nBlue;
等方式,但沒有辦法複製..