microsoft / HoloLensForCV

Sample code and documentation for using the Microsoft HoloLens for Computer Vision research
MIT License
475 stars 154 forks source link

cut-apart and distorted long throw depth frames #116

Open emeraldy opened 5 years ago

emeraldy commented 5 years ago

Hi,

I have been trying to visualise the long throw depth data returned by MediaFrameReader. I use the following code snippet to obtain the byte array of the frame's SoftwareBitmap

bitmapBuffer = bitmap-> LockBuffer(Windows::Graphics::Imaging::BitmapBufferAccessMode::Read);

bitmapBufferReference = bitmapBuffer->CreateReference();

uint32_t bitmapBufferDataSize = 0;

uint8_t* bitmapBufferData = Io::GetTypedPointerToMemoryBuffer(bitmapBufferReference, bitmapBufferDataSize);

and then I just interpret every two elements of bitmapBufferData as a pixel on the depth map but when I plotted out the resulting uint16 2D array, I got the images likes these:

depth1 depth2 as you can see, they are not only cut into two parts but distorted as well. Any idea what the problem could be? Thanks in advance.