我試圖從Kinect生成將圖像幀傳遞給人臉檢測/跟蹤算法。我已經看到,從openGL紋理生成jpeg圖像的最好方法是通過libjpeg,但我對如何開始無能爲力。這就是我對我現在的代碼:使用openNi/NITE從Kinect生成jpeg圖像
//draw image frame to texture
const XnRGB24Pixel* pImageRow = g_imageMD.RGB24Data();
XnRGB24Pixel* pTexRow = g_pTexMap + g_imageMD.YOffset() * g_nTexMapX;
for (XnUInt y = 0; y < g_imageMD.YRes(); ++y)
{
const XnRGB24Pixel* pImage = pImageRow;
XnRGB24Pixel* pTex = pTexRow + g_imageMD.XOffset();
for (XnUInt x = 0; x < g_imageMD.XRes(); ++x, ++pImage, ++pTex)
{
*pTex = *pImage;
}
pImageRow += g_imageMD.XRes();
pTexRow += g_nTexMapX;
}
// Create the OpenGL texture map
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, g_nTexMapX, g_nTexMapY, 0, GL_RGB, GL_UNSIGNED_BYTE, g_pTexMap);
所以,我怎麼可以把這塊g_pTexMap東西保存爲JPEG圖像?
這是什麼語言? C ? C++? C# ?阿達? Fortran語言?爲您的問題添加適當的標籤。 – karlphillip
啊對不起。我已經添加了C++標籤。 –