예제 #1
0
 public void TestConstrutor()
 {
     DepthFrameData data = new DepthFrameData();
     bool pass = data.DataPointer != IntPtr.Zero;
     data.Dispose();
     Assert.AreEqual(true, pass);
 }
예제 #2
0
        /// <summary>
        /// Update map from a depth frame
        /// </summary>
        /// <param name="coordinateMapper"></param>
        /// <param name="depthFrame"></param>
        public void Update(CoordinateMapper coordinateMapper, DepthFrameData depthFrame)
        {
            if (this.dataPointer == IntPtr.Zero)
                throw new ObjectDisposedException("ColorToDepthFrameData");

            coordinateMapper.MapColorFrameToDepthSpaceUsingIntPtr(depthFrame.DataPointer,(uint)depthFrame.SizeInBytes,this.dataPointer,(uint)this.sizeInBytes);
        }
예제 #3
0
        /// <summary>
        /// Contructor
        /// </summary>
        /// <param name="depthData">Depth Frame data</param>
        public DepthFrameDataEventArgs(DepthFrameData depthData)
        {
            if (depthData == null)
                throw new ArgumentNullException("depthData");

            this.depthData = depthData;
        }
예제 #4
0
        public void TestDisposeAccess()
        {
            DepthFrameData data = new DepthFrameData();
            data.Dispose();

            //Should throw exception
            var pointer = data.DataPointer;
        }
예제 #5
0
 public void TestSize()
 {
     DepthFrameData data = new DepthFrameData();
     int expected = 512 * 424 * 2;
     bool pass = data.SizeInBytes == expected;
     data.Dispose();
     Assert.AreEqual(pass, true);
 }
예제 #6
0
 public void DepthTestConstructor()
 {
     using (DepthFrameData depthFrame = new DepthFrameData())
     {
         DepthFrameDataEventArgs args = new DepthFrameDataEventArgs(depthFrame);
         Assert.AreEqual(depthFrame, args.DepthData);
     }
 }
예제 #7
0
        public void TestMultipleDispose()
        {
            DepthFrameData data = new DepthFrameData();
            data.Dispose();
            //Second call to dispose should do nothing
            data.Dispose();

            Assert.AreEqual(data.DataPointer, IntPtr.Zero);
        }
예제 #8
0
        /// <summary>
        /// Update map from a depth frame
        /// </summary>
        /// <param name="coordinateMapper"></param>
        /// <param name="depthFrame"></param>
        public void Update(CoordinateMapper coordinateMapper, DepthFrameData depthFrame)
        {
            if (this.dataPointer == IntPtr.Zero)
            {
                throw new ObjectDisposedException("ColorToDepthFrameData");
            }

            coordinateMapper.MapDepthFrameToColorSpaceUsingIntPtr(depthFrame.DataPointer, (uint)depthFrame.SizeInBytes, this.dataPointer, (uint)this.sizeInBytes);
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="sensor">Kinect sensor</param>
        public KinectSensorDepthFrameProvider(KinectSensor sensor)
        {
            if (sensor == null)
                throw new ArgumentNullException("sensor");

            this.sensor = sensor;
            this.depthReader = this.sensor.DepthFrameSource.OpenReader();
            this.depthReader.FrameArrived += depthReader_FrameArrived;
            this.frameData = new DepthFrameData();
        }
예제 #10
0
 public void TestCopy()
 {
     using (DepthFrameData frame = new DepthFrameData())
     {
         using (DynamicDepthTexture texture = new DynamicDepthTexture(device))
         {
             texture.Copy(device.ImmediateContext, frame);
         }
     }
 }
예제 #11
0
        /// <summary>
        /// Creates an immutable depth texture, allocates GPU resources
        /// </summary>
        /// <param name="device">Direct3D Device</param>
        /// <param name="data">Depth frame data</param>
        public ImmutableDepthTexture(Device device, DepthFrameData data)
        {
            if (device == null)
                throw new ArgumentNullException("device");
            if (data == null)
                throw new ArgumentNullException("data");

            DataRectangle dr = new DataRectangle(data.DataPointer, Consts.DepthWidth * sizeof(ushort));

            this.texture = new Texture2D(device, DepthTextureDescriptors.ImmutableResource, dr);
            this.rawView = new ShaderResourceView(device,this.texture, DepthTextureDescriptors.RawView);
            this.normalizedView = new ShaderResourceView(device,this.texture, DepthTextureDescriptors.NormalizedView);
        }
예제 #12
0
        public static DepthFrameData RandomDepthFrame()
        {
            DepthFrameData data = new DepthFrameData();
            Random r = new Random();
            ushort[] d = new ushort[512 * 424];
            for (int i = 0; i < d.Length; i++)
            {
                d[i] = (ushort)r.Next(0, ushort.MaxValue);
            }

            fixed (ushort* ptr = &d[0])
            {
                memcpy(data.DataPointer, new IntPtr(ptr), 512 * 424 * 2);
            }

            return data;
        }
예제 #13
0
 public void TestDisposedSize()
 {
     DepthFrameData data = new DepthFrameData();
     data.Dispose();
     Assert.AreEqual(data.SizeInBytes, 0);
 }
 private void FrameReceived(object sender, DepthFrameDataEventArgs e)
 {
     this.currentFrameData = e.DepthData;
     this.upload = true;
 }
예제 #15
0
 /// <summary>
 /// Updates frame data from coordinate mapper
 /// </summary>
 /// <param name="coordinateMapper">Coordinate mapper</param>
 /// <param name="depthFrame">depth frame</param>
 public void Update(CoordinateMapper coordinateMapper, DepthFrameData depthFrame)
 {
     coordinateMapper.MapDepthFrameToCameraSpaceUsingIntPtr(depthFrame.DataPointer, (uint)depthFrame.SizeInBytes, this.dataPointer, (uint)this.sizeInBytes);
 }
예제 #16
0
 /// <summary>
 /// Updates frame data from coordinate mapper
 /// </summary>
 /// <param name="coordinateMapper">Coordinate mapper</param>
 /// <param name="depthFrame">depth frame</param>
 public void Update(CoordinateMapper coordinateMapper, DepthFrameData depthFrame)
 {
     coordinateMapper.MapDepthFrameToCameraSpaceUsingIntPtr(depthFrame.DataPointer, (uint)depthFrame.SizeInBytes, this.dataPointer, (uint)this.sizeInBytes);
 }
예제 #17
0
 /// <summary>
 /// Copy depth frame to graphics card
 /// </summary>
 /// <param name="context">Device context</param>
 /// <param name="data">Depth frame data</param>
 public void Copy(DeviceContext context, DepthFrameData data)
 {
     this.texture.Upload(context, data.DataPointer, data.SizeInBytes);
 }
 public DummyDepthProvider()
 {
     this.frameData = new DepthFrameData();
 }
예제 #19
0
 public void TestDispose()
 {
     DepthFrameData data = new DepthFrameData();
     data.Dispose();
     Assert.AreEqual(data.DataPointer, IntPtr.Zero);
 }