- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I tired to get raw depth data by calling function AcquireAccess(ACCESS_READ, PIXEL_FORMAT_DEPTH_RAW, &data);
But it always failed. If I use PIXEL_FORMAT_DEPTH or PIXEL_FORMAT_DEPTH_F32, then data.type is correct but the data values remain the same, which means floating point data is value is the same with the depth ones.
Anybody know what is the reason ? I am using R200.
Thanks!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please provide the part how you enable the stream or whole codes so I can help you find the issue. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
David Lu (Intel) wrote:
Please provide the part how you enable the stream or whole codes so I can help you find the issue. Thanks!
Hi David,
Here are the codes, at the line 21:
#include <Windows.h> #include <assert.h> #include <iomanip> #include <iostream> #include <string> #include <opencv2/opencv.hpp> #include "pxcsensemanager.h" #include "pxcmetadata.h" #include "util_cmdline.h" #include "util_render.h" #include <conio.h> static void cvtPXCImageToMat(PXCImage *inImg, cv::Mat *outImg, PXCImage::PixelFormat format) { int cvDataType; int cvDataWidth; PXCImage::ImageData data; /* The function either failed or gives wrong format of data !!!! */ inImg->AcquireAccess(PXCImage::Access::ACCESS_READ, format, &data); PXCImage::ImageInfo imgInfo = inImg->QueryInfo(); std::cout << "The required format is: " << format << ", \n the actual format is: " << data.format << "\n"; switch (data.format) { case PXCImage::PIXEL_FORMAT_DEPTH: case PXCImage::PIXEL_FORMAT_DEPTH_RAW: cvDataType = CV_16U; cvDataWidth = 2; break; case PXCImage::PIXEL_FORMAT_DEPTH_F32: cvDataType = CV_32F; cvDataWidth = 4; break; } assert(data.planes[1] == NULL); assert(data.pitches[0] % cvDataWidth == 0); outImg->create(imgInfo.height, data.pitches[0] / cvDataWidth, cvDataType); memcpy(outImg->data, data.planes[0], imgInfo.height*imgInfo.width*cvDataWidth*sizeof(pxcBYTE)); inImg->ReleaseAccess(&data); } #define SAFE_RELEASE(pt) ((pt)->Release()) static void recording() { PXCSenseManager *pm = PXCSenseManager::CreateInstance(); pm->EnableStream(PXCCapture::STREAM_TYPE_DEPTH, 320, 240, 30.f); pm->Init(); UtilRender *renderD = new UtilRender(L"Depth"); cv::Mat depth; while (1) { if (pm->AcquireFrame(true) < PXC_STATUS_NO_ERROR) break; const PXCCapture::Sample *sample = pm->QuerySample(); if (sample) { if (sample->depth) { cvtPXCImageToMat(sample->depth, &depth, PXCImage::PIXEL_FORMAT_DEPTH_RAW); renderD->RenderFrame(sample->depth); } if (27 == cvWaitKey(10)) break; } pm->ReleaseFrame(); } delete renderD; SAFE_RELEASE(pm); } int main(int argc, char *argv[]) { recording(); return 0; }
In my machine if I changed the format to DEPTH_RAW it will fail, if I changed it to DEPTH_F32, the pixel values are the same with the DEPTH ones. Which is useless for me. If you could identify the reason, that's will be helpful !
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No one could help ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I just subscribed to the thread / I had a similar issue in C# and it ended up to be a wrong frame release for me. (data was not refreshing as they should).
I will look into the code pasted in the coming days and see if i can come up with any valuable input :)

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page