JackP
JackP

Reputation: 47

Display VideoFrame on screen

Well, I'm stucked in displaying the VideoFrame.

VideoFrame inputVideoFrame, croppedFace=null;
croppedFace = new VideoFrame(BitmapPixelFormat.Bgra8, (int)width, (int)height, BitmapAlphaMode.Ignore);
await inputVideoFrame.CopyToAsync(croppedFace, cropBounds, null);

I want to display the VideoFrame type, inputVideoFrame on xaml. (on image or captureelement)

Is there any way to do it?

Upvotes: 1

Views: 182

Answers (1)

kennyzx
kennyzx

Reputation: 12993

Try this

SoftwareBitmap previewFrame = inputVideoFrame.SoftwareBitmap;

var sbSource = new SoftwareBitmapSource();
await sbSource.SetBitmapAsync(previewFrame);

// Display it in the Image control
PreviewFrameImage.Source = sbSource;

See this sample.

Upvotes: 2

Related Questions