Sensor Programming

I need some help in sensor program .Please suggest the roadmap Please find the requirement in Kinect sensor project.
1. First It needs to do kinect connection.( SDKs are there dowloaded.It is connected I checked in C:\Program Files\OpenNI2\Samples\Bin for connection performances)
2. Access the kinect sensor through MFC app.(It is not done using coding in mfc)
3. Write an mfc program to generate a point cloud(Point clouds dimensions are triggered by app of DEVELOPER TOOLKIT BROWSER )
And retrieve the point cloud in x y z.
4.Generate the z value of the object sitting in front of it into inches.(Kinect sensor has array value of 640*480)
5. So create exe that has dialoge box to click on run sensor returns the closet point.
Can anybody suggest on this ?
I am blocked in this case and It is necessary to complete task as soon as possible.
Last edited on
Yes I have done all needed set ups.
I am having problem in getting the right values of z means ditance of object from the camera.
I got some values in milimeter but those are coming .09 like that .That is wrong.
I have used the function NuiTransformDepthImageToSkeleton() for getting the image depth in front of the camera.
This is the method I am getting the data
long* depth2rgb = (long*) depthToRgbMap;
NUI_IMAGE_FRAME imageFrame;
NUI_LOCKED_RECT LockedRect;
if (sensor->NuiImageStreamGetNextFrame(depthStream, 0, &imageFrame) < 0) return;
INuiFrameTexture* texture = imageFrame.pFrameTexture;
texture->LockRect(0, &LockedRect, NULL, 0);
if (LockedRect.Pitch != 0) {
const USHORT* curr = (const USHORT*) LockedRect.pBits;

for (int j = 0; j < height; ++j)
{
std::ofstream fout3("XYZW_Value_MM.txt");
if (fout3.is_open())
{
fout3 << "X" << "\t\t" << "Y"<<"\t\t"<< "Z" << "\t\t" << "W" << std::endl;
for (int i = 0; i < width; ++i)
{
// Get depth of pixel in millimeters
USHORT depth = NuiDepthPixelToDepth(*curr++);
// Store coordinates of the point corresponding to this pixel
Vector4 pos1;
Vector4 pos = NuiTransformDepthImageToSkeleton(i, j, depth << 3, NUI_IMAGE_RESOLUTION_640x480);
long double x, y, z, w;
x = pos.x ;
y = pos.y ;
z = pos.z ;
w = pos.w ;
fout3 << x << "\t";
fout3 << y << "\t";
fout3 << z << "\t";
fout3 << w << std::endl;
// Store the index into the color array corresponding to this pixel
NuiImageGetColorPixelCoordinatesFromDepthPixelAtResolution(
NUI_IMAGE_RESOLUTION_640x480, NUI_IMAGE_RESOLUTION_640x480, NULL,
i, j, depth << 3, depth2rgb, depth2rgb + 1);
depth2rgb += 2;
}
}
}
}
texture->UnlockRect(0);
sensor->NuiImageStreamReleaseFrame(depthStream, &imageFrame);
}
It is not giving right value .Please suggst.
Topic archived. No new replies allowed.