|
@@ -4,7 +4,7 @@ using System.Runtime.InteropServices;
|
|
|
using Iisu;
|
|
|
using MathNet.Numerics.LinearAlgebra.Single;
|
|
|
|
|
|
-namespace bbiwarg
|
|
|
+namespace bbiwarg.DataSource
|
|
|
{
|
|
|
class IIsuDataSource: IVideoDataSource
|
|
|
{
|
|
@@ -26,6 +26,7 @@ namespace bbiwarg
|
|
|
private IDataHandle<Iisu.Data.Vector3[]>[] fingerTipPositions3D = new IDataHandle<Iisu.Data.Vector3[]>[2];
|
|
|
private IDataHandle<int>[] handSides = new IDataHandle<int>[2];
|
|
|
private IDataHandle<Iisu.Data.IImageData> depthImage;
|
|
|
+ private IDataHandle<Iisu.Data.IImageData> colorImage;
|
|
|
|
|
|
/*
|
|
|
* Creates an Iisu data source.
|
|
@@ -58,6 +59,8 @@ namespace bbiwarg
|
|
|
|
|
|
// data
|
|
|
depthImage = device.RegisterDataHandle<Iisu.Data.IImageData>("SOURCE.CAMERA.DEPTH.Image");
|
|
|
+
|
|
|
+ colorImage = device.RegisterDataHandle<Iisu.Data.IImageData>("SOURCE.CAMERA.COLOR.Image");
|
|
|
|
|
|
handOpen[0] = device.RegisterDataHandle<bool>("CI.HAND1.IsOpen");
|
|
|
handOpen[1] = device.RegisterDataHandle<bool>("CI.HAND2.IsOpen");
|
|
@@ -128,13 +131,22 @@ namespace bbiwarg
|
|
|
|
|
|
IntPtr imageData = depthImage.Value.Raw;
|
|
|
|
|
|
- short[] tmp = new short[width * height];
|
|
|
- Marshal.Copy(imageData, tmp, 0, width * height);
|
|
|
+ short[] depthData = new short[width * height];
|
|
|
+ Marshal.Copy(imageData, depthData, 0, width * height);
|
|
|
+
|
|
|
+ return new DepthImage(width, height, depthData);
|
|
|
+ }
|
|
|
+
|
|
|
+ public ColorImage getColorImage()
|
|
|
+ {
|
|
|
+ Iisu.Data.IImageInfos imageInfos = depthImage.Value.ImageInfos;
|
|
|
+ int width = (int)imageInfos.Width;
|
|
|
+ int height = (int)imageInfos.Height;
|
|
|
+ int numBytes = (int)imageInfos.BytesRaw;
|
|
|
|
|
|
- ushort[] data = new ushort[width * height];
|
|
|
- Buffer.BlockCopy(tmp, 0, data, 0, numBytes);
|
|
|
+ Console.WriteLine("width: " + width + " height: " + height + " numBytes: " + numBytes);
|
|
|
|
|
|
- return new DepthImage(width, height, data);
|
|
|
+ return new ColorImage();
|
|
|
}
|
|
|
|
|
|
private void checkHandIndex(uint handIndex)
|