private void Context_VideoFrameReady(object sender, ImageFrameReadyEventArgs e) { if (!ViewType.HasFlag(CameraView.Color)) { return; } // 32-bit per pixel, RGBA image PlanarImage image = e.ImageFrame.Image; BitmapSource bitmap = BitmapSource.Create( image.Width, image.Height, 96, 96, PixelFormats.Bgr32, null, image.Bits, image.Width * image.BytesPerPixel); bitmap.Freeze(); OnCameraUpdated(bitmap, CameraView.Color); }
private void Context_DepthFrameReady(object sender, ImageFrameReadyEventArgs e) { if (!(ViewType.HasFlag(CameraView.Depth) || ViewType.HasFlag(CameraView.ColoredDepth))) { //We don't need the depth camera return; } //TODO: Depth view beter uitwerken //Aan de hand van de examples // 32-bit per pixel, RGBA image PlanarImage image = e.ImageFrame.Image; BitmapSource bitmap = BitmapSource.Create(image.Width, image.Height, 96, 96, PixelFormats.Gray16, null, image.Bits, image.Width * image.BytesPerPixel); bitmap.Freeze(); //PlanarImage image = e.ImageFrame.Image; //byte[] convertedDepthFrame = ConvertDepthFrame(image.Bits, ViewType.HasFlag(CameraView.ColoredDepth)); //BitmapSource bitmap = BitmapSource.Create( // image.Width, image.Height, 96, 96, PixelFormats.Bgr32, null, convertedDepthFrame, image.Width*4); //bitmap.Freeze(); OnCameraUpdated(bitmap, ViewType); }
protected virtual void FilterViewTypeList(ViewType viewType) { cboViewType.DataSource = null; IList <ViewType> filteredViewTypes = new List <ViewType>(); foreach (ViewType viewTypeItem in Enum.GetValues(typeof(ViewType))) { if (viewTypeItem != ViewType.All) { if (viewType.HasFlag(viewTypeItem)) { filteredViewTypes.Add(viewTypeItem); } } } cboViewType.DataSource = filteredViewTypes; cboViewType.SelectedIndex = 0; cboViewType.Enabled = filteredViewTypes.Count > 1; }