chmarkes
chmarkes

Reputation: 61

Capturing Webcam Image without preview view or cameraUI?

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?

Upvotes: 4

Views: 610

Answers (1)

chmarkes
chmarkes

Reputation: 61

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);

Upvotes: 2

Related Questions