public void TestConstrutor()
 {
     BodyIndexFrameData data = new BodyIndexFrameData();
     bool pass = data.DataPointer != IntPtr.Zero;
     data.Dispose();
     Assert.AreEqual(true, pass);
 }
 public void TestSize()
 {
     BodyIndexFrameData data = new BodyIndexFrameData();
     int expected = 512 * 424;
     bool pass = data.SizeInBytes == expected;
     data.Dispose();
     Assert.AreEqual(pass, true);
 }
        public void TestDisposeAccess()
        {
            BodyIndexFrameData data = new BodyIndexFrameData();
            data.Dispose();

            //Should throw exception
            var pointer = data.DataPointer;
        }
 public void BodyIndexTestConstructor()
 {
     using (BodyIndexFrameData frame = new BodyIndexFrameData())
     {
         BodyIndexFrameDataEventArgs args = new BodyIndexFrameDataEventArgs(frame);
         Assert.AreEqual(frame, args.FrameData);
     }
 }
        public void TestMultipleDispose()
        {
            BodyIndexFrameData data = new BodyIndexFrameData();
            data.Dispose();
            //Second call to dispose should do nothing
            data.Dispose();

            Assert.AreEqual(data.DataPointer, IntPtr.Zero);
        }
 public void TestCopy()
 {
     using (BodyIndexFrameData frame = new BodyIndexFrameData())
     {
         using (DynamicBodyIndexTexture texture = new DynamicBodyIndexTexture(device))
         {
             texture.Copy(device.ImmediateContext, frame);
         }
     }
 }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="sensor">Kinect sensor</param>
        public KinectSensorBodyIndexFrameProvider(KinectSensor sensor)
        {
            if (sensor == null)
                throw new ArgumentNullException("sensor");

            this.sensor = sensor;
            this.reader = this.sensor.BodyIndexFrameSource.OpenReader();
            this.reader.FrameArrived += this.FrameArrived;
            this.frameData = new BodyIndexFrameData();
        }
Esempio n. 8
0
        public static BodyIndexFrameData RandomBodyIndexFrame()
        {
            BodyIndexFrameData data = new BodyIndexFrameData();
            Random r = new Random();
            byte[] d = new byte[512 * 424];
            for (int i = 0; i < d.Length; i++)
            {
                d[i] = (byte)r.Next(0, byte.MaxValue);
            }

            fixed (byte* ptr = &d[0])
            {
                memcpy(data.DataPointer, new IntPtr(ptr), 512 * 424);
            }
            return data;
        }
 public void TestDisposedSize()
 {
     BodyIndexFrameData data = new BodyIndexFrameData();
     data.Dispose();
     Assert.AreEqual(data.SizeInBytes, 0);
 }
Esempio n. 10
0
 public void TestDispose()
 {
     BodyIndexFrameData data = new BodyIndexFrameData();
     data.Dispose();
     Assert.AreEqual(data.DataPointer, IntPtr.Zero);
 }
 private void FrameReceived(object sender, BodyIndexFrameDataEventArgs e)
 {
     this.currentFrameData = e.FrameData;
     this.upload = true;
 }
 public DummyBodyIndexProvider()
 {
     this.frameData = new BodyIndexFrameData();
 }
 /// <summary>
 /// Constructor
 /// </summary>
 public BodyIndexFrameDataEventArgs(BodyIndexFrameData args)
 {
     if (args == null)
         throw new ArgumentNullException("args");
     this.args = args;
 }
Esempio n. 14
0
 /// <summary>
 /// Copy body index data fromcpu to gpu
 /// <remarks>In that case we should use immediate context, do not use a deffered context 
 /// unless you really know what you do</remarks>
 /// </summary>
 /// <param name="context">Device context</param>
 /// <param name="frame">Frame data</param>
 public void Copy(DeviceContext context, BodyIndexFrameData frame)
 {
     this.texture.Upload(context, frame.DataPointer, frame.SizeInBytes);
 }