C# OpenNI显示RGB摄像机馈送
上周我一直试图让我的C#程序同时显示深度提要和RGB提要(类似于/Samples/Bin64/Release/NiViewer64.exe在窗口中显示这两个提要) 项目规范:C#-VS2013 Express OpenNI-使用修改的 SimpleViewer.net(有两个深度提要)。华硕Xtion Pro Live 我想其中一个饲料成为一个正常的相机饲料而不是深度饲料 我猜这与此有关:C# OpenNI显示RGB摄像机馈送,c#,camera,openni,depth,C#,Camera,Openni,Depth,上周我一直试图让我的C#程序同时显示深度提要和RGB提要(类似于/Samples/Bin64/Release/NiViewer64.exe在窗口中显示这两个提要) 项目规范:C#-VS2013 Express OpenNI-使用修改的 SimpleViewer.net(有两个深度提要)。华硕Xtion Pro Live 我想其中一个饲料成为一个正常的相机饲料而不是深度饲料 我猜这与此有关: MapOutputMode mapMode = this.depth.MapOutputMode; thi
MapOutputMode mapMode = this.depth.MapOutputMode;
this.bitmap = new Bitmap((int)mapMode.XRes, (int)mapMode.YRes,System.Drawing.Imaging.PixelFormat.Format24bppRgb);
有什么想法吗?多亏了另一位程序员,终于想出了办法
image = context.FindExistingNode(NodeType.Image) as ImageGenerator;
ImageMetaData imd = image.GetMetaData();
lock (this)
{
//**************************************//
//***********RGB Camera Feed************//
//**************************************//
Rectangle rect = new Rectangle(0, 0, this.bitmap.Width, this.bitmap.Height);
BitmapData data = this.camera_feed.LockBits(rect, ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
byte* pDest = (byte*)data.Scan0.ToPointer();
byte* imstp = (byte*)image.ImageMapPtr.ToPointer();
// set pixels
for (int i = 0; i < imd.DataSize; i += 3, pDest += 3, imstp += 3)
{
pDest[0] = imstp[2];
pDest[1] = imstp[1];
pDest[2] = imstp[0];
}
public ImageGenerator image;