예제 #1
0
    def pop_result(self, timeout_in_ms=_k4a.K4A_WAIT_INFINITE):
        """Gets the next available body frame.

		Parameters:
		k4abt_frame_t* body_frame_handle: If successful this contains a handle to a body frame object.
		timeout_in_ms (int):Specifies the time in milliseconds the function should block waiting for the capture. If set to 0, the function will
							return without blocking. Passing a value of #K4A_WAIT_INFINITE will block indefinitely until data is available, the
							device is disconnected, or another error occurs.

		Returns:
		None

		Remarks:
		Retrieves the next available body frame result and pop it from the output queue in the k4abt_tracker_t. If a new body
		frame is not currently available, this function will block up until the timeout is reached. The SDK will buffer at
		least three body frames worth of data before stopping new capture being queued by k4abt_tracker_enqueue_capture.
		Once body_frame data is read, the user must call k4abt_frame_release() to return the allocated memory to the SDK.

		Upon successfully reads a body frame this function will return success.
		"""
        if self.tracker_running:
            _k4abt.VERIFY(
                self.k4abt.k4abt_tracker_pop_result(self.tracker_handle,
                                                    self.body_frame_handle,
                                                    timeout_in_ms),
                "Body tracker get body frame failed!")
예제 #2
0
    def enqueue_capture(self,
                        capture_handle,
                        timeout_in_ms=_k4a.K4A_WAIT_INFINITE):
        """Add a k4a sensor capture to the tracker input queue to generate its body tracking result asynchronously.

		Parameters:h
		k4a_capture_t sensor_capture_handle: Handle to a sensor capture returned by k4a_device_get_capture() from k4a SDK.
		timeout_in_ms (int):Specifies the time in milliseconds the function should block waiting for the capture. If set to 0, the function will
							return without blocking. Passing a value of #K4A_WAIT_INFINITE will block indefinitely until data is available, the
							device is disconnected, or another error occurs.

		Returns:
		None

		Remarks:
		Add a k4a capture to the tracker input queue so that it can be processed asynchronously to generate the body tracking
		result. The processed results will be added to an output queue maintained by k4abt_tracker_t instance. Call
		k4abt_tracker_pop_result to get the result and pop it from the output queue.
		If the input queue or output queue is full, this function will block up until the timeout is reached.
		Once body_frame data is read, the user must call k4abt_frame_release() to return the allocated memory to the SDK

		Upon successfully insert a sensor capture to the input queue this function will return success.
		"""
        _k4abt.VERIFY(
            self.k4abt.k4abt_tracker_enqueue_capture(self.tracker_handle,
                                                     capture_handle,
                                                     timeout_in_ms),
            "Body tracker capture enqueue failed!")
	def get_body_skeleton(self, index=0):
		"""Get the joint information for a particular person index from the k4abt_frame_t

		Parameters:
		k4abt_frame_t* body_frame_handle: Handle to a body frame object returned by k4abt_tracker_pop_result function.
		uint32_t index: The index of the body of which the joint information is queried.
		
		Returns:
		k4abt_skeleton_t* skeleton: If successful this contains the body skeleton information.

		Remarks:
		Called when the user has received a body frame handle and wants to access the data contained in it.
		"""
		skeleton = _k4abt.k4abt_skeleton_t()

		_k4abt.VERIFY(self.k4abt.k4abt_frame_get_body_skeleton(self.body_frame_handle, index, skeleton), "Body tracker get body skeleton failed!")

		return skeleton
	def initializeTracker(self):
		"""Initialize the body tracker

		Parameters:
		k4a_calibration_t calibration: Camera calibration for capture processing
		k4abt_tracker_configuration_t config: Cofiguration for the body tracker
		k4abt_tracker_t* tracker_handle: handle of the body tracker
			
		Returns:
		None
		
		Remarks:
		If successful, k4abt_tracker_create() will return a body tracker handle in the tracker parameter. This handle grants
		* access to the body tracker and may be used in the other k4abt API calls.

		When done with body tracking, close the handle with k4abt_tracker_destroy().
		"""
		_k4abt.VERIFY(self.k4abt.k4abt_tracker_create(self.sensor_calibration, self.tracker_config, self.tracker_handle), "Body tracker initialization failed!")
		self.tracker_running = True