Developer technologies | Universal Windows Platform (UWP)
A Microsoft platform for building and publishing apps for Windows devices.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
On my device has three source group, when switch to the HP IR Camera, MediaCapture: : AddVideoEffectAsync add face detection effect throw exceptions: The data specified for the media type is invalid, inconsistent, or not supported by this object.winRT information: The Input format is unsupported. What should I do
auto definition = ref new FaceDetectionEffectDefinition();
// To ensure preview smoothness, do not delay incoming samples
definition->SynchronousDetectionEnabled = false;
// In this scenario, choose detection speed over accuracy
definition->DetectionMode = FaceDetectionMode::HighPerformance;
// Add the effect to the preview stream
return create_task(m_mediaCapture->AddVideoEffectAsync(definition, Capture::MediaStreamType::VideoPreview))
.then([this](IMediaExtension^ extension)
{
_faceDetectionEffect = static_cast<FaceDetectionEffect^>(extension);
// Register for face detection events
_faceDetectedEventToken =
_faceDetectionEffect->FaceDetected += ref new TypedEventHandler<FaceDetectionEffect^, FaceDetectedEventArgs^>(this, &Scenario2_FindAvailableSourceGroups::FaceDetectionEffect_FaceDetected);
// Choose the shortest interval between detection events
Windows::Foundation::TimeSpan duration = Windows::Foundation::TimeSpan();
duration.Duration = 330000; // hundreds of nanoseconds (33ms)
_faceDetectionEffect->DesiredDetectionInterval = duration;
// Start detecting faces
_faceDetectionEffect->Enabled = true;
return task_from_result();
}).then([](task<void> previousTask) {
try {
previousTask.get();
}
catch (Platform::COMException^ e) {
OutputDebugString(e->Message->Data());
}
});