在屏幕上显示VideoFrame

时间:2018-10-30 01:18:43

标签: c# uwp

好吧,我被困在显示VideoFrame中。

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

我想在xaml上显示VideoFrame类型inputVideoFrame。 (在图像或捕获元素上)

有什么办法吗?

1 个答案:

答案 0 :(得分:2)

尝试一下

SoftwareBitmap previewFrame = inputVideoFrame.SoftwareBitmap;

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

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

请参阅此sample