Hi all,
I tried to get the IR stream from my PrimeSensor. I got a output but
it isn't shown correctly.
Here are some pictures.
http://i53.tinypic.com/2j3p4hs.png
A correct image should look like the pic in the upper left corner.
This pic is taken from the NiViewer sample.
The result image of my program is in the upper right corner. The image
is 16bit unsigned (IPL_DEPTH_16U).
And the last picture in the lower right corner is the same output from
my program as 8bit image (IPL_DEPTH_8U) instead of a 16bit image.
Does anybody know what I have done wrong?
Would be very glad for any help!
Cheer,
Klaus
This is my code
XnStatus nRetVal = XN_STATUS_OK;
nRetVal = context.Init();
nRetVal = ir.Create(context);
nRetVal = context.StartGeneratingAll();
IplImage* image = cvCreateImage(cvSize(640,480), IPL_DEPTH_16U, 1);
cvNamedWindow("Window", CV_WINDOW_AUTOSIZE);
while (true)
{
-----nRetVal = context.WaitAndUpdateAll();
-----ir.GetMetaData(irMD);
-----const XnIRPixel* pIrRow = irMD.Data();
-----for (XnUInt y = 0; y < irMD.YRes(); y++)
-----{
----------const XnIRPixel* pIRmap = pIrRow;
----------for (XnUInt x = 0; x < irMD.XRes(); x++, pIRmap++)
----------{
---------------((uchar *)(image ->imageData + y*image ->widthStep))
[x*image ->nChannels + 0] = pIrRow[x];
----------}
----------pIrRow += irMD.XRes();
-----}
-----cvShowImage("Window", image);
}