Azure Kinect SDK 1.4.1 Body Tracking For More Than 1 Person

Romil Game Dev 0 Reputation points
2023-06-15T12:02:19.7733333+00:00

I'm a Game Developer working on a Unity Project using Azure Kinect SDK v1.4.1. I'm using the Body Tracking Sample from the SDK. I was wondering it can track more than 1 person at a time? I have been scratching my head and found nothing about this anywhere.

To have 2 bodies being tracked in the body tracking sample, i have 2 scripts,1. Main.cs and other is TrackerHandler.cs. Where can i make changes for it to work with 2 people.

I tried making another instance of the main script and attached a copy of the Kinect4AzureTracker prefab and plugged it into the tracker field. It still works with only 1 person.

What can I do to have the body tacking work with 2 people in-front of the lens in the same scene.

Azure Kinect DK
Azure Kinect DK
A Microsoft developer kit and peripheral device with advanced artificial intelligence sensors for sophisticated computer vision and speech models.
292 questions
{count} votes

1 answer

Sort by: Most helpful
  1. LeelaRajeshSayana-MSFT 14,831 Reputation points Microsoft Employee
    2023-06-15T15:25:08.4333333+00:00

    Hi @Romil Game Dev Greetings! Welcome to Microsoft Q&A forum. Thank you for posting your question here.

    I wanted to check if you have looked into this article Access data in body frame on Azure Kinect DK documentation. The documentation states you can get the SDK to track Multiple bodies in a single capture using the function k4abt_frame_get_num_bodies()

    Please refer the below sample code that helps to achieve this

    size_t num_bodies = k4abt_frame_get_num_bodies(body_frame);
    for (size_t i = 0; i < num_bodies; i++) 
    {     
        k4abt_skeleton_t skeleton;     
        k4abt_frame_get_body_skeleton(body_frame, i, &skeleton);     
        uint32_t id = k4abt_frame_get_body_id(body_frame, i); 
        k4a_image_t body_index_map = k4abt_frame_get_body_index_map(body_frame);  
        // Do your work with the body index map 
        k4a_image_release(body_index_map);
        k4a_capture_t input_capture = k4abt_frame_get_capture(body_frame); 
        // Do your work with the input capture 
        k4a_capture_release(input_capture);
    }
    
    
    

    Hope this helps. Please let us know if you face any issues testing the sample or do not see the results as expected.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.