【发布时间】:2015-04-06 21:09:58
【问题描述】:
我正在尝试使用 sdk 中的 coordinateMapper 函数将深度图映射到色彩空间。但是,我收到的输出不是我所期望的,它似乎具有较小的纵横比,并且图像似乎是镜像的。
下面是我使用的代码:
depthWidth = depthFrameDescription.Width;
depthHeight = depthFrameDescription.Height;
var colorDesc = colorFrame.FrameDescription;
int colorWidth = colorDesc.Width;
int colorHeight = colorDesc.Height;
int size = colorWidth * colorHeight;
DepthSpacePoint[] colSpacePoints = new DepthSpacePoint[colorWidth * colorHeight];
using (KinectBuffer depthFrameData = depthFrame.LockImageBuffer())
using (KinectBuffer colorBuffer = colorFrame.LockRawImageBuffer())
{
this.bitmap.Lock();
if ((colorWidth == this.bitmap.PixelWidth) && (colorHeight == this.bitmap.PixelHeight))
{
byte[] colorFrameData = new byte[size * bytesPerPixel];
// Map the values here
ushort [] frameData = new ushort[depthWidth * depthHeight];
depthFrame.CopyFrameDataToArray(frameData);
coordinateMapper.MapColorFrameToDepthSpace(frameData, colSpacePoints);
this.bitmap.WritePixels(new Int32Rect(0, 0, colorWidth, colorHeight), colSpacePoints, colorWidth * bytesPerPixel, 0);
this.bitmap.AddDirtyRect(new Int32Rect(0, 0, this.bitmap.PixelWidth, this.bitmap.PixelHeight));
}
this.bitmap.Unlock();
}
this.bitmapBackBufferSize = (uint)![enter image description here][1]((this.bitmap.BackBufferStride * (this.bitmap.PixelHeight - 1)) + (this.bitmap.PixelWidth * this.bytesPerPixel));
isBitmapLocked = true;
【问题讨论】:
标签: c# kinect kinect-sdk