public void Create(DepthDataFrame depthDataFrame, IntPtr pointer) { var data = new short[this.size.Width * this.size.Height]; Marshal.Copy(pointer, data, 0, data.Length); Buffer.BlockCopy(data, 0, depthDataFrame.Data, 0, data.Length * sizeof(short)); }
public DepthDataFrame Create(IntPtr pointer) { var depthDataFrame = new DepthDataFrame(this.size.Width, this.size.Height); this.Create(depthDataFrame, pointer); return(depthDataFrame); }
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]); }
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); } }
public TestDepthFrame(string id, DepthDataFrame frame, IEnumerable <HandDataViewModel> hands) { this.Id = id; this.Frame = frame; this.Hands = new BindingList <HandDataViewModel>(hands.ToList()); }
public TestDepthFrame(DepthDataFrame frame) : this() { this.Frame = frame; }
private void AddNewDepthFrame(DepthDataFrame depthDataFrame) { var testFrame = new TestDepthFrame(depthDataFrame); this.AddFrame(testFrame); }
void VideoPresenter_NewFrameCaptured(DepthDataFrame depthDataFrame) { this.AddNewDepthFrame(depthDataFrame); }
public void Setup() { this.depthDataFrame = new DepthDataFrame(20, 10); this.depthDataFrame.Data[1] = 1; this.dataSource = new DepthFramePointerDataSource(this.depthDataFrame); }
public void Create(DepthDataFrame depthDataFrame, IntPtr pointer) { var data = new short[this.size.Width * this.size.Height]; Marshal.Copy(pointer, data, 0, data.Length); Buffer.BlockCopy(data, 0, depthDataFrame.Data, 0, data.Length * sizeof(short)); }
public DepthDataFrame Create(IntPtr pointer) { var depthDataFrame = new DepthDataFrame(this.size.Width, this.size.Height); this.Create(depthDataFrame, pointer); return depthDataFrame; }
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); }