public MainWindow() { InitializeComponent(); // Open Device device = K4A.Device.Open(); // Start Cameras device.StartCameras(new K4A.DeviceConfiguration { ColorFormat = K4A.ImageFormat.ColorBGRA32, ColorResolution = K4A.ColorResolution.R720p, DepthMode = K4A.DepthMode.NFOV_Unbinned, SynchronizedImagesOnly = true }); // Create Buffer int depth_width = device.GetCalibration().DepthCameraCalibration.ResolutionWidth; int depth_height = device.GetCalibration().DepthCameraCalibration.ResolutionHeight; const int depth_channles = 1; depth_stride = depth_width * sizeof(byte) * depth_channles; depth_rect = new Int32Rect(0, 0, depth_width, depth_height); depth_bitmap = new WriteableBitmap(depth_width, depth_height, 96.0, 96.0, PixelFormats.Gray8, null); // Bined Image Control Depth_Image.Source = depth_bitmap; Depth_Image.Width = depth_width; Depth_Image.Height = depth_height; }
public MainWindow() { InitializeComponent(); // Open Device device = K4A.Device.Open(); // Start Cameras device.StartCameras(new K4A.DeviceConfiguration { ColorFormat = K4A.ImageFormat.ColorBGRA32, ColorResolution = K4A.ColorResolution.R720p, DepthMode = K4A.DepthMode.NFOV_Unbinned, SynchronizedImagesOnly = true }); // Create Transformation transformation = device.GetCalibration().CreateTransformation(); // Create Buffer #if TO_COLOR int width = device.GetCalibration().ColorCameraCalibration.ResolutionWidth; int height = device.GetCalibration().ColorCameraCalibration.ResolutionHeight; #else int width = device.GetCalibration().DepthCameraCalibration.ResolutionWidth; int height = device.GetCalibration().DepthCameraCalibration.ResolutionHeight; #endif const int color_channles = 4; color_stride = width * sizeof(byte) * color_channles; color_rect = new Int32Rect(0, 0, width, height); color_bitmap = new WriteableBitmap(width, height, 96.0, 96.0, PixelFormats.Bgra32, null); const int depth_channles = 1; depth_stride = width * sizeof(byte) * depth_channles; depth_rect = new Int32Rect(0, 0, width, height); depth_bitmap = new WriteableBitmap(width, height, 96.0, 96.0, PixelFormats.Gray8, null); // Bined Image Control Color_Image.Source = color_bitmap; Color_Image.Width = width; Color_Image.Height = height; Depth_Image.Source = depth_bitmap; Depth_Image.Width = width; Depth_Image.Height = height; }
public MainWindow() { InitializeComponent(); // Open Device device = K4A.Device.Open(); // Start Cameras device.StartCameras(new K4A.DeviceConfiguration { ColorFormat = K4A.ImageFormat.ColorBGRA32, ColorResolution = K4A.ColorResolution.R720p, DepthMode = K4A.DepthMode.NFOV_2x2Binned, SynchronizedImagesOnly = true }); // Get Calibration calibration = device.GetCalibration(K4A.DepthMode.NFOV_2x2Binned, K4A.ColorResolution.R720p); // Create Tracker tracker = K4ABT.Tracker.Create( calibration, new K4ABT.TrackerConfiguration { SensorOrientation = K4ABT.SensorOrientation.Default, ProcessingMode = K4ABT.TrackerProcessingMode.Gpu } ); // Create Buffer int color_width = calibration.ColorCameraCalibration.ResolutionWidth; int color_height = calibration.ColorCameraCalibration.ResolutionHeight; const int color_channles = 4; color_stride = color_width * sizeof(byte) * color_channles; color_rect = new Int32Rect(0, 0, color_width, color_height); color_bitmap = new WriteableBitmap(color_width, color_height, 96.0, 96.0, PixelFormats.Bgra32, null); // Generate Color LUT colors = new Color[6]; colors[0] = new Color() { B = 255, G = 0, R = 0, A = 128 }; colors[1] = new Color() { B = 0, G = 255, R = 0, A = 128 }; colors[2] = new Color() { B = 0, G = 0, R = 255, A = 128 }; colors[3] = new Color() { B = 255, G = 255, R = 0, A = 128 }; colors[4] = new Color() { B = 0, G = 255, R = 255, A = 128 }; colors[5] = new Color() { B = 255, G = 0, R = 255, A = 128 }; // Bined Image Control Color_Image.Source = color_bitmap; Color_Image.Width = color_width; Color_Image.Height = color_height; // Set Cnvas Size Canvas_Body.Width = color_width; Canvas_Body.Height = color_height; }