2015-02-04 57 views
2

我正在開發一個Windows UI C#應用程序,我試圖捕獲一個攝像頭圖像而不使用CameraCaptureUI,因爲我不想在我的應用程序中有任何中斷。在沒有預覽視圖或cameraUI的情況下捕獲攝像頭圖像?

我在畫布上使用簽名,並且我想要在用戶的簽名開始簽名以驗證身份而不更改畫面時捕獲用戶臉部的圖像。

我該怎麼做到這一點?

+0

歡迎來到Stack Overflow。請花點時間回顧一下[我可以在這裏詢問哪些主題?](http://stackoverflow.com/help/on-topic)。你的問題非常模糊,沒有任何代碼或嘗試解決方案,這兩者都屬於[我應該避免詢問什麼類型的問題?](http://stackoverflow.com/help/dont-ask)。 –

回答

1

我想出瞭如何做到這一點。使用新的MediaCapture和ImageEncodingProperties項目,我能夠在沒有任何預覽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);