4

I'm developing a windows UI C# app and I'm attempting to Capture a webcam image without using the CameraCaptureUI, as I don't want any interruptions in my app.

I am using signatures on a canvas, and I want to capture an image of the user's face when he begins his signature to verify identities without altering the screen.

How might I accomplish this?

Nikolay Kostov
  • 16,433
  • 23
  • 85
  • 123
chmarkes
  • 61
  • 2
  • Welcome to Stack Overflow. Please take a moment and review [What topics can I ask about here?](http://stackoverflow.com/help/on-topic). Your question is very vague without any code or attempts at a solution, both of which fall under the [What types of questions should I avoid asking?](http://stackoverflow.com/help/dont-ask). – Erik Philips Feb 04 '15 at 23:08

1 Answers1

2

I figured out how to do this. Using a new MediaCapture, and an ImageEncodingProperties item, i was able to capture the images without any preview UI.

captureManager = new MediaCapture();
    await captureManager.InitializeAsync();
    ImageEncodingProperties imgFormat = ImageEncodingProperties.CreatePng();

// create storage file in local app storage
    StorageFile file = await ApplicationData.Current.LocalFolder.CreateFileAsync(
                "face"+picnum+".png",
                CreationCollisionOption.ReplaceExisting);
 // take photo
    await captureManager.CapturePhotoToStorageFileAsync(imgFormat, file);
chmarkes
  • 61
  • 2
  • Adding permission to access cam and audio would be required to make this work as suggested here: https://stackoverflow.com/questions/34952684/uwp-mediacapture-denied-access-to-camera – Aditya Nair Jan 10 '23 at 18:27