6 Replies Latest reply on Apr 25, 2017 2:47 PM by Intel Corporation

    Problems getting depth distance in mm


      Hi, i´m trying to get the depth distance of each pixel of a frame from a recorded video with a R200, but the result that i´m getting is allways 0.0000


      Here is my code:


      void readFrame(pxcCHAR *file, bool record) {



        PXCSenseManager* sm = PXCSenseManager::CreateInstance();



        // Set file playback name

        sm->QueryCaptureManager()->SetFileName(file, false);



        // Enable stream and Initialize

        sm->EnableStream(PXCCapture::STREAM_TYPE_COLOR, 640, 480, 0);

        sm->EnableStream(PXCCapture::STREAM_TYPE_DEPTH, 0, 0, 0);




        // Set realtime=false and pause=true



        // Streaming loop

        for (int i = 0; i < 4; i++) {//I just take 4 frames

        // Set to work on every frame of data



        // Ready for the frame to be ready

        pxcStatus sts = sm->AcquireFrame(true);

        if (sts < PXC_STATUS_NO_ERROR) break;



        // Retrieve the sample and work on it. The image is in sample->color.

        PXCCapture::Sample* sample = sm->QuerySample();





        PXCImage::ImageData data;

        PXCImage::PixelFormat format;

        format= PXCImage::PIXEL_FORMAT_DEPTH_RAW;

        float c=sample->depth->AcquireAccess(PXCImage::ACCESS_READ, format, &data);


        int width = sample->depth->QueryInfo().width;

        int height = sample->depth->QueryInfo().height;


        if (!format)

        format = sample->depth->QueryInfo().format;


        printf("%d  %d\n",width,height);

        printf("%f\n", c);





      for (int i = 0; i < 500000000; i++) {}


        // Resume processing the next frame



        // Clean up







      I think that doing

        float c=sample->depth->AcquireAccess(PXCImage::ACCESS_READ, format, &data);

      it´s not the correct way to obtain the depth distance in mm of each pixel of the frame, but i don´t know how to obtain it and print it then.


      Any ideas of how to accomplish it?