internal async void chkAddRemoveEffect_Unchecked(Object sender, Windows.UI.Xaml.RoutedEventArgs e) { try { chkAddRemoveEffect.IsEnabled = false; await m_mediaCaptureMgr.ClearEffectsAsync(Windows.Media.Capture.MediaStreamType.VideoPreview); ShowStatusMessage("Remove effect from preview successful"); if (m_bEffectAddedToRecord) { await m_mediaCaptureMgr.ClearEffectsAsync(Windows.Media.Capture.MediaStreamType.VideoRecord); ShowStatusMessage("Remove effect from preview successful"); m_bEffectAddedToRecord = false; } if (m_bEffectAddedToPhoto) { await m_mediaCaptureMgr.ClearEffectsAsync(Windows.Media.Capture.MediaStreamType.Photo); ShowStatusMessage("Remove effect from preview successful"); m_bEffectAddedToRecord = false; } chkAddRemoveEffect.IsEnabled = true; } catch (Exception exception) { ShowExceptionMessage(exception); } }
// Removes the grayscale effect. private async void AddRemoveEffect_Unchecked(object sender, RoutedEventArgs e) { try { AddRemoveEffect.IsEnabled = false; await mediaCapture.ClearEffectsAsync(Windows.Media.Capture.MediaStreamType.Photo); ShowStatusMessage("Remove effect from preview successful"); AddRemoveEffect.IsEnabled = true; } catch (Exception ex) { ShowExceptionMessage(ex); } }
private async void FaceComp_Loaded(object sender, RoutedEventArgs e) { var cameraID = await GetCameraID(Windows.Devices.Enumeration.Panel.Back); takePhotoManager = new MediaCapture(); await takePhotoManager.InitializeAsync(new MediaCaptureInitializationSettings { StreamingCaptureMode = StreamingCaptureMode.Video, //PhotoCaptureSource = PhotoCaptureSource.Photo, AudioDeviceId = string.Empty, VideoDeviceId = cameraID.Id }); await takePhotoManager.ClearEffectsAsync(MediaStreamType.Photo); PhotoPreview.Source = takePhotoManager; await takePhotoManager.StartPreviewAsync(); }
private async void getWebcam2() { MediaCapture capture = new MediaCapture(); await capture.InitializeAsync(); await capture.ClearEffectsAsync(MediaStreamType.VideoRecord); cap_CaptureElement.Source = capture; await capture.StartPreviewAsync(); }