我可以从Live Web Cam获得面孔作为Windows.Media.FaceAnalysis DetectedFace对象列表。现在,我想将这些面孔传递给Microsoft Cognitive Services API,以检测面孔并获取面孔属性。我怎样才能做到这一点?
IList<DetectedFace> faces = null;
// Create a VideoFrame object specifying the pixel format we want our capture image to be (NV12 bitmap in this case).
// GetPreviewFrame will convert the native webcam frame into this format.
const BitmapPixelFormat InputPixelFormat = BitmapPixelFormat.Nv12;
using (VideoFrame previewFrame = new VideoFrame(InputPixelFormat, (int)this.videoProperties.Width, (int)this.videoProperties.Height))
{
await this.mediaCapture.GetPreviewFrameAsync(previewFrame);
// The returned VideoFrame should be in the supported NV12 format but we need to verify this.
if (FaceDetector.IsBitmapPixelFormatSupported(previewFrame.SoftwareBitmap.BitmapPixelFormat)) …Run Code Online (Sandbox Code Playgroud) c# microsoft-cognitive uwp face-api azure-cognitive-services