def transform_depth_to_color(self, input_depth_image_handle, color_image_handle): calibration = _k4a.k4a_calibration_t() # Get desired image format image_format = self.image_get_format(input_depth_image_handle) image_width = self.image_get_width_pixels(color_image_handle) image_height = self.image_get_height_pixels(color_image_handle) image_stride = 0 # Get the camera calibration self.device_get_calibration(self.config.depth_mode, self.config.color_resolution, calibration) # Create transformation transformation_handle = self.transformation_create(calibration) # Create the image handle transformed_depth_image_handle = _k4a.k4a_image_t() self.image_create(image_format, image_width, image_height, image_stride, transformed_depth_image_handle) # Transform the depth image to the color image format self.transformation_depth_image_to_color_camera( transformation_handle, input_depth_image_handle, transformed_depth_image_handle) # Get transformed image data transformed_image = self.image_convert_to_numpy( transformed_depth_image_handle) # Close transformation self.transformation_destroy(transformation_handle) return transformed_image
def __init__(self, modulePath, sensor_calibration, modelType): _k4abt.k4abt.setup_library(modulePath) self.k4abt = _k4abt.k4abt() try: cdll.LoadLibrary( "C:/Program Files/Azure Kinect Body Tracking SDK/tools/directml.dll" ) except Exception as e: _k4abt.K4ABT_TRACKER_CONFIG_DEFAULT.processing_mode = _k4abt.K4ABT_TRACKER_PROCESSING_MODE_GPU_CUDA self.tracker_handle = _k4abt.k4abt_tracker_t() if modelType == 1: try: _k4abt.K4ABT_TRACKER_CONFIG_DEFAULT.model_path = "C:/Program Files/Azure Kinect Body Tracking SDK/sdk/windows-desktop/amd64/release/bin/dnn_model_2_0_lite_op11.onnx".encode( 'utf-8') except Exception as e: print( "Failed to find lite model. Check that you are using Body Tracker version 1.1.0\n" ) print("Switching to the original body tracking model\n\n\n") self.tracker_config = _k4abt.K4ABT_TRACKER_CONFIG_DEFAULT self.body_frame_handle = _k4abt.k4abt_frame_t() self.segmented_body_img = _k4a.k4a_image_t() self.capture_handle = _k4a.k4a_capture_t() self.sensor_calibration = sensor_calibration self.tracker_running = False self.bodiesNow = [] self.initializeTracker()
def __init__(self, modulePath, sensor_calibration): self.k4abt = _k4abt.k4abt(modulePath) self.tracker_handle = _k4abt.k4abt_tracker_t() self.tracker_config = _k4abt.K4ABT_TRACKER_CONFIG_DEFAULT self.body_frame_handle = _k4abt.k4abt_frame_t() self.segmented_body_img = _k4a.k4a_image_t() self.capture_handle = _k4a.k4a_capture_t() self.sensor_calibration = sensor_calibration self.tracker_running = False self.bodiesNow = [] self.initializeTracker()