C# Raw Depth Values

C# Raw Depth Values

imagem de Dean W.

I've been looking at the samples included with the SDK, but the c# samples are very limited compared to the c++ ones. I'm trying to get some sort of array of depth values, similar to what's done with the Kinect sensors, but I haven't had any luck. My goal is to be able to compare all the depth values in a given frame.

Is there a simple way to achieve this? Any hints/pointers would be greatly appreciated, thank you.

9 posts / 0 new
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.
imagem de Xintian Wu (Intel)

Quick pseudo code (not tested):

UtilMPipeline pp;

pp.EnableImage(PXCMImage.ColorFormat.COLOR_FORMAT_DEPTH);

pp.Init();

for (;;) {

      if (!pp.AcquireFrame(true)) break;

      PXCMImage image=pp.QueryImage(PXCMImage.ImageFormat.IMAGE_FORMAT_DEPTH);

      pp.ReleaseFrame();

}

pp.Close();

pp.Dispose();

 

imagem de Edwin C.

Hi Xintian, thanks for your reply, I got it working now!

imagem de Pavleen T.

Hello, 

    I am very confused on this topic. Once you have the PXCImage of the depth how do you gain access to the actual depth values??? I just want to be able to save an array of all the depth values for each frame to a text file. How can I do this? It seems like I'm missing something really simple. I have been trying to do this for days. BTW i'm actually working in C++ so the same way you did pseudo code above or even a C++ implementation would really help me out. 

Please help. 

imagem de Xintian Wu (Intel)

For C++, please see the UVmap sample for how to access the values.

For C#, there is no equivalent sample but the same API applies.

 

imagem de Shyam

Hey Dean,

Can you share you solution, I was trying similar.

Thanks

imagem de Xintian Wu (Intel)

After QueryImage above, you call the AcquireAccess function to retrieve the depth value, as follows:

PXCMImage.Data data;

image.AcquireAccess(PXCMImage.Access.READ_ACCESS,out data);

// The depth image is pointed by the PXCMImage.Data structure.

image.ReleaseAccess(ref data); 

 

Note that the image buffer is in the unmanaged memory. So use Marshal copy to copy it to a managed buffer.

imagem de Xintian Wu (Intel)

Here is a piece of code from the C++/CLI porting library QueryBitmap. You can see how to access the unmanaged image buffer:

    PXCImage::ImageData data;

    sts=QueryInstance()->AcquireAccess(PXCImage::ACCESS_READ,accel,PXCImage::COLOR_FORMAT_RGB32,&data);

    bitmap=gcnewSystem::Drawing::Bitmap(info.width,info.height,data.pitches[0],System::Drawing::Imaging::PixelFormat::Format32bppRgb,(IntPtr)data.planes[0]);

    QueryInstance()->ReleaseAccess(&data);

imagem de Xintian Wu (Intel)

Here is a piece of code from the C++/CLI porting library QueryBitmap. You can see how to access the unmanaged image buffer:

    PXCImage::ImageData data;

    sts=QueryInstance()->AcquireAccess(PXCImage::ACCESS_READ,accel,PXCImage::COLOR_FORMAT_RGB32,&data);

    bitmap=gcnewSystem::Drawing::Bitmap(info.width,info.height,data.pitches[0],System::Drawing::Imaging::PixelFormat::Format32bppRgb,(IntPtr)data.planes[0]);

    QueryInstance()->ReleaseAccess(&data);

Faça login para deixar um comentário.