public static extern k4a_transformation_t k4a_transformation_create([In] ref Calibration calibration);
 public static extern k4a_result_t k4a_device_get_calibration(
     k4a_device_t device_handle,
     DepthMode depth_mode,
     ColorResolution color_resolution,
     out Calibration calibration);
 public static extern k4a_result_t k4a_calibration_get_from_raw(
     byte[] raw_calibration,
     UIntPtr raw_calibration_size,
     DepthMode depth_mode,
     ColorResolution color_resolution,
     out Calibration calibration);
 public static extern k4a_result_t k4a_calibration_3d_to_3d(
     [In] ref Calibration calibration,
     ref Vector3 source_point3d,
     Calibration.DeviceType source_camera,
     Calibration.DeviceType target_camera,
     out Vector3 target_point3d);
        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;
        }
예제 #6
0
 public static extern k4a_result_t k4abt_tracker_create([In] ref Calibration sensor_calibration, TrackerConfiguration config, out k4abt_tracker_t tracker_handle);
예제 #7
0
 public static extern k4a_result_t k4a_calibration_color_2d_to_depth_2d(
     [In] ref Calibration calibration,
     ref Vector2 source_point2d,
     k4a_image_t depth_image,
     out Vector2 target_point2d,
     out bool valid);