Face Tracking added to Nuitrack SDK!

Dear Dave,

Excellent thank you!

Dear Guilherme,

We published a face tracking tutorial here: http://download.3divi.com/Nuitrack/doc/UnityFaceTracking_page.html

1 Like

Thank you!!! I’m on it!

Is there anyway to use this inside Linux? I think this example is suitable for Windows because of Unity. Would love to know more.

You can try Unity beta for linux https://forum.unity.com/threads/latest-linux-deb-package.535434/

Thanks Aleksandr, for quick reply.

I want to know the best way to use TViCO.
Could you please put some light in to my concern?

How to track only single user( closest to the camera ) without modifying config file

Hi sonam,

You can use either SkeletonTracker::setNumActiveUsers (C++) or nuitrack.SkeletonTracker.SetNumActiveUsers (C#) method. Please take a look at our documentation.

Thanks for the reply. I’m looking for something like this

private void onUserTrackerUpdate(UserFrame userFrame)
        {
            _userFrame = userFrame;            
          
            User temp = ClosestUser(_userFrame); 
            Image<Gray, byte> imgeOrigenal;
            depthData = _depthFrame.Data;
            int index = 0;
            if (userFrame.NumUsers > 1)
            {
                foreach (User current in userFrame.Users)
                {
                    bitmapMat = Mat.Zeros(HEIGHT, WIDTH, Emgu.CV.CvEnum.DepthType.Cv8U, 3);
                    imgeOrigenal = new Image<Gray, byte>(WIDTH, HEIGHT);

                    DEPTH = new byte[WIDTH * HEIGHT];

                for (int i = 0; i < HEIGHT; i++)
                {
                    for (int j = 0; j < WIDTH; j++)
                    {
                        ushort depth = userFrame[i, j];

                        //if (depth > 0 && userFrame.NumUsers == 1)
                        //DEPTH[index] = (byte)(255);
                        if (depth > 0 && temp.ID == ID)
                            DEPTH[index] = (byte)(255);
                        else
                            DEPTH[index] = (byte)(0);
                        index++;
                    }
                }
                imgeOrigenal.Bytes = DEPTH;
                bitmapMat = imgeOrigenal.Mat;
                CvInvoke.Imshow("Original", bitmapMat);
                                   
            }
        }
    }

User Tracker processes the whole depth map and provides info about all tracked users. Therefore, you have to determine the closest user to the sensor on the application layer.

With Nuitrack API, you can find the distance to the center mass of a user:

User.real.Z

yes i had did that way only but does not worked. See this is my function where i am getting ID of closest user or Z value.
//Check line number 2 in previous function -> onUserTrackerUpdate
//Change it to -> int temp = ClosestUser(_userFrame);
//Change line -> if (depth > 0 && temp.ID == ID) line to -> if (depth > 0 && temp == current.ID) or -> if (depth > 0 && temp == current.Z )

 public void ClosestUser(UserFrame _userFrame)
        {
            float minDistance = 0f;
            int ID = 0; // int ZCopy = 0;
            foreach (User current in _userFrame.Users)
            {               
                float distance = current.Real.Z; 

                if (distance < minDistance)
                {                   
                    minDistance = distance;
                    //ZCopy = minDistance;
                    ID = current.ID;
                }                
            }
            return ID;  //ZCopy 
        }  

whether i use ID or ZCopy i don’t get desired output.

Please review the following line:

float minDistance = 0f;

Instead of 0, you have to set another value, which should be large enough (for example, 10000, which is “ten meters”). The distance to a user in the depth map should be less than this value.