public void Save(DepthDataFrame frame, string path)
 {
     using (var fileStream = new FileStream(path, FileMode.Create))
     {
         this.Save(frame, fileStream);
     }
 }
 public void Save(DepthDataFrame frame, string path)
 {
     using (var fileStream = new FileStream(path, FileMode.Create))
     {
         this.Save(frame, fileStream);
     }
 }
示例#3
0
 public void Index_Access_Returns_The_Right_Value()
 {
     var frame = new DepthDataFrame(2, 2, new ushort[] { 1, 2, 3, 4 });
     Assert.AreEqual(1, frame[0, 0]);
     Assert.AreEqual(2, frame[1, 0]);
     Assert.AreEqual(3, frame[0, 1]);
     Assert.AreEqual(4, frame[1, 1]);
 }
示例#4
0
        public void Test_With_And_Height_Properties()
        {
            int width = 20;
            int height = 10;

            var frame = new DepthDataFrame(width, height);

            Assert.AreEqual(width, frame.Width);
            Assert.AreEqual(height, frame.Height);

            Assert.AreEqual(frame.Size.Width, frame.Width);
            Assert.AreEqual(frame.Size.Height, frame.Height);
        }
        public void Saved_Frame_Can_Be_Restored()
        {
            var repository = new DepthDataFrameRepository(new IntSize(20, 10));
            var frame = new DepthDataFrame(20, 10);
            int anIndex = 1;
            ushort aValue = 2;

            frame.Data[anIndex] = aValue;
            var path = Path.GetTempFileName();
            repository.Save(frame, path);
            
            var loadedFrame = repository.Load(path);
            File.Delete(path);

            Assert.AreEqual(aValue, loadedFrame.Data[anIndex]);
        }
        public void DepthImage_Colors_Fade_With_Distance()
        {
            var bitmap = new Bitmap(20, 10);
            var factory = new DepthBitmapFactory(200);
            var frame = new DepthDataFrame(20, 10);
            for (int index = 0; index < frame.Data.Length; index++)
            {
                frame.Data[index] = (ushort) index;
            }

            var pointerFactory = new ArrayToPointerFactory();
            var pointer = pointerFactory.CreatePointer(frame.Data);
            try
            {
                factory.CreateImage(bitmap, pointer);
                AssertColorsFade(bitmap);
            }
            finally
            {
                pointerFactory.Destroy(pointer);
            }
        }
示例#7
0
 public void Max_Depth_Returns_The_Maximum_Depth()
 {
     var frame = new DepthDataFrame(2, 2, new ushort[] { 1, 2, 3, 4 });
     Assert.AreEqual(4, frame.MaxDepth);
 }
 private unsafe IntPtr GetPointer(DepthDataFrame frame)
 {
     return this.pointerFactory.CreatePointer(frame.Data);
 }
 public DepthFramePointerDataSource(DepthDataFrame frame)
 {
     this.frame = frame;
     this.pointerFactory = new ArrayToPointerFactory();
     this.CurrentValue = this.GetPointer(frame);
 }
示例#10
0
 private void AddNewDepthFrame(DepthDataFrame depthDataFrame)
 {
     var testFrame = new TestDepthFrame(depthDataFrame);
     this.AddFrame(testFrame);
 }
 public void Setup()
 {
     this.depthDataFrame = new DepthDataFrame(20, 10);
     this.depthDataFrame.Data[1] = 1;
     this.dataSource = new DepthFramePointerDataSource(this.depthDataFrame);
 }
 public void Save(DepthDataFrame frame, Stream outputStream)
 {
     this.Save(frame.Data, outputStream);
 }
示例#13
0
 private unsafe IntPtr GetPointer(DepthDataFrame frame)
 {
     return(this.pointerFactory.CreatePointer(frame.Data));
 }
示例#14
0
 public DepthFramePointerDataSource(DepthDataFrame frame)
 {
     this.frame          = frame;
     this.pointerFactory = new ArrayToPointerFactory();
     this.CurrentValue   = this.GetPointer(frame);
 }
 public void Save(DepthDataFrame frame, Stream outputStream)
 {
     this.Save(frame.Data, outputStream);
 }
示例#16
0
 public TestDepthFrame(DepthDataFrame frame)
     : this()
 {
     this.Frame = frame;
 }
示例#17
0
 public TestDepthFrame(string id, DepthDataFrame frame, IEnumerable<HandDataViewModel> hands)
 {
     this.Id = id;
     this.Frame = frame;
     this.Hands = new BindingList<HandDataViewModel>(hands.ToList());
 }
示例#18
0
 void VideoPresenter_NewFrameCaptured(DepthDataFrame depthDataFrame)
 {
     this.AddNewDepthFrame(depthDataFrame);
 }