// Update Depth inline void Kinect::updateDepth( const ComPtr<IMultiSourceFrame>& multiSourceFrame ) { if( multiSourceFrame == nullptr ){ return; } // Retrieve Depth Frame Reference ComPtr<IDepthFrameReference> depthFrameReference; HRESULT ret = multiSourceFrame->get_DepthFrameReference( &depthFrameReference ); if( FAILED( ret ) ){ return; } // Retrieve Depth Frame ComPtr<IDepthFrame> depthFrame; ret = depthFrameReference->AcquireFrame( &depthFrame ); if( FAILED( ret ) ){ return; } // Retrieve Depth Data ERROR_CHECK( depthFrame->CopyFrameDataToArray( static_cast<UINT>( depthBuffer.size() ), &depthBuffer[0] ) ); }
// Update Color inline void Kinect::updateColor( const ComPtr<IMultiSourceFrame>& multiSourceFrame ) { if( multiSourceFrame == nullptr ){ return; } // Retrieve Color Frame Reference ComPtr<IColorFrameReference> colorFrameReference; HRESULT ret = multiSourceFrame->get_ColorFrameReference( &colorFrameReference ); if( FAILED( ret ) ){ return; } // Retrieve Color Frame ComPtr<IColorFrame> colorFrame; ret = colorFrameReference->AcquireFrame( &colorFrame ); if( FAILED( ret ) ){ return; } // Convert Format ( YUY2 -> BGRA ) ERROR_CHECK( colorFrame->CopyConvertedFrameDataToArray( static_cast<UINT>( colorBuffer.size() ), &colorBuffer[0], ColorImageFormat::ColorImageFormat_Bgra ) ); }