/// <summary> /// Contructor /// </summary> /// <param name="frameData">Frame data</param> public InfraredFrameDataEventArgs(InfraredFrameData frameData) { if (frameData == null) throw new ArgumentNullException("frameData"); this.frameData = frameData; }
public void TestConstrutor() { InfraredFrameData data = new InfraredFrameData(); bool pass = data.DataPointer != IntPtr.Zero; data.Dispose(); Assert.AreEqual(true, pass); }
public void TestSize() { InfraredFrameData data = new InfraredFrameData(); int expected = 512 * 424 * 2; bool pass = data.SizeInBytes == expected; data.Dispose(); Assert.AreEqual(pass, true); }
public void TestDisposeAccess() { InfraredFrameData data = new InfraredFrameData(); data.Dispose(); //Should throw exception var pointer = data.DataPointer; }
public void InfraredTestConstructor() { using (InfraredFrameData depthFrame = new InfraredFrameData()) { InfraredFrameDataEventArgs args = new InfraredFrameDataEventArgs(depthFrame); Assert.AreEqual(depthFrame, args.FrameData); } }
public void TestMultipleDispose() { InfraredFrameData data = new InfraredFrameData(); data.Dispose(); //Second call to dispose should do nothing data.Dispose(); Assert.AreEqual(data.DataPointer, IntPtr.Zero); }
/// <summary> /// Constructor /// </summary> /// <param name="sensor">Kinect sensor</param> public KinectSensorInfraredFrameProvider(KinectSensor sensor) { if (sensor == null) throw new ArgumentNullException("sensor"); this.sensor = sensor; this.reader = this.sensor.InfraredFrameSource.OpenReader(); this.reader.FrameArrived += FrameArrived; this.frameData = new InfraredFrameData(); }
public void TestCopy() { using (InfraredFrameData frame = new InfraredFrameData()) { using (DynamicInfraredTexture texture = new DynamicInfraredTexture(device)) { texture.Copy(device.ImmediateContext, frame); } } }
/// <summary> /// Creates a dynamic depth texture, allocates GPU resources /// </summary> /// <param name="device">Direct3D Device</param> /// <param name="frameData">Initial frame data</param> public ImmutableInfraredTexture(Device device, InfraredFrameData frameData) { if (device == null) throw new ArgumentNullException("device"); if (frameData == null) throw new ArgumentNullException("frameData"); DataRectangle rect = new DataRectangle(frameData.DataPointer, Consts.DepthWidth * sizeof(ushort)); this.texture = new Texture2D(device, InfraredTextureDescriptors.DynamicResource,rect); this.shaderView = new ShaderResourceView(device, this.texture); }
public void TestDisposedSize() { InfraredFrameData data = new InfraredFrameData(); data.Dispose(); Assert.AreEqual(data.SizeInBytes, 0); }
public void TestDispose() { InfraredFrameData data = new InfraredFrameData(); data.Dispose(); Assert.AreEqual(data.DataPointer, IntPtr.Zero); }
/// <summary> /// Copy depth frame to graphics card /// </summary> /// <param name="context">Device context</param> /// <param name="data">Infrared frame data</param> public void Copy(DeviceContext context, InfraredFrameData data) { this.texture.Upload(context, data.DataPointer, data.SizeInBytes); }