none
Bug: Native FaceBasics does not work with MultiSourceReader RRS feed

  • Question

  • When the PublicPreview-1408 version was released, I was very excited to see a native example for FaceBasics.  I've finally been able to see a working example and can modify the existing code.

    It immediately became apparent that the example code is using ColorFrameReader and BodyFrameReader separately.  The example works as expected with this set up.  I modifed the example to use a MultiSourceFrameReader in place of the two readers, this setup mimics how my application had been running.  When using the MultiSourceFrameReader, the color frame is still displayed but the face information is never displayed.

    The working example has the following in CFaceBasics::UpdateBodyData():

    HRESULT CFaceBasics::UpdateBodyData(IBody** ppBodies)
    {
      HRESULT hr = E_FAIL;
      if (m_pBodyFrameReader != nullptr)
      {
        IBodyFrame* pBodyFrame = nullptr;
        hr = m_pBodyFrameReader->AcquireLatestFrame(&pBodyFrame);
        if (SUCCEEDED(hr))
        {
          hr = pBodyFrame->GetAndRefreshBodyData(BODY_COUNT, ppBodies);
        }
        SafeRelease(pBodyFrame);
      }
    
      return hr;
    }

    However, when the method is modified to use MultiSourceFrameReader:

    HRESULT CFaceBasics::UpdateBodyData(IBody** ppBodies)
    {
      HRESULT hr = E_FAIL;
    
      IMultiSourceFrame* pMultiSourceFrame = nullptr;
      hr = m_pMultiSourceReader->AcquireLatestFrame(&pMultiSourceFrame);
    
      IBodyFrameReference* pBodyFrameReference = nullptr;
      if (SUCCEEDED(hr))
      {
        hr = pMultiSourceFrame->get_BodyFrameReference(&pBodyFrameReference);
      }
    
      IBodyFrame* pBodyFrame = nullptr;
      if (SUCCEEDED(hr))
      {
        hr = pBodyFrameReference->AcquireFrame(&pBodyFrame);
      }
      if (SUCCEEDED(hr))
      {
        hr = pBodyFrame->GetAndRefreshBodyData(BODY_COUNT, ppBodies);
      }
    
      SafeRelease(pBodyFrame);
      SafeRelease(pBodyFrameReference);
      SafeRelease(pMultiSourceFrame);
    
      return hr;
    }

    the call to 

    pFaceFrame->get_IsTrackingIdValid(&bFaceTracked);

    is always set to FALSE and the Face Information is never displayed.

    Is there some other step during setup that needs to occur for the MultiSourceFrameReader to work?  I have Color | Body | BodyIndex being passed to the MultiSourceFrameReader when it is opened.

    Thanks.

    Thursday, August 21, 2014 4:58 PM

All replies

  • How does the MultiSourceFrameReader(MSFR) sample (coordinate mapper) work on your machine? Are you getting 30fps?

    When using MSFR, you are given very small window to do anything with the data before you start falling behind. The runtime is designed to keep strict 30fps on any frame you are "locking". Any delay in unlocking the frame, will cause future frames to be dropped from your application at the runtime level.

    The pattern shown in the sample is the correct method to ensure you are always processing frames. Because you are always acquiring the latest frames, they should be within 1 frame of latency of each other. If you acquire the frames depending on scheduling this should be fairly accurate. Doing it this way gives the developer full control on how they want to process the data.


    Carmine Sirignano - MSFT

    Monday, August 25, 2014 6:29 PM