Hololens/Lib/Cameras.cs
//#############################################################################################
/// <summary>
/// Capture a frame from the videostream. Doesn't work if callback is enabled.
/// </summary>
/// <returns> true indicate that _frame attribute is updated </returns>
Capture a frame from the videostream. Doesn't work if callback is enabled.
Capture a frame from the videostream . Doesn ' t work if callback is enabled .
private bool ReadFrame()
        {
            using (var mediaFrameReference = _mediaFrameReader.TryAcquireLatestFrame()) 
            {
                var videoMediaFrame = mediaFrameReference?.VideoMediaFrame; 
                var softwareBitmap = videoMediaFrame?.SoftwareBitmap; 
                if (softwareBitmap != null)
                {
                    _frame = softwareBitmap; 
                    mediaFrameReference.Dispose();
                    return true;
                }
                else
                {
                    return false;
                }
            }
        }
private bool ReadFrame ( ) { using ( var mediaFrameReference = _mediaFrameReader . TryAcquireLatestFrame ( ) ) { var videoMediaFrame = mediaFrameReference ? . VideoMediaFrame ; var softwareBitmap = videoMediaFrame ? . SoftwareBitmap ; if ( softwareBitmap != null ) { _frame = softwareBitmap ; mediaFrameReference . Dispose ( ) ; return true ; } else { return false ; } } }
Capture a frame from the videostream.
Capture a frame from the videostream .
// look for the last frame captured // object that represent the frame // frame as SoftwareBitmap // frame is saved inside _frame attribute
true indicate that _frame attribute is updated
true indicate that _frame attribute is updated