简体   繁体   中英

C# Surface Pro 4 Camera

I am developing a WPF program in visual studio 2013. This program will be installed on MS Surface Pro 4's , one part of the application required to take an snap photo from the front camera.

I would like to place a button in my WPF program that will open the surface Pro 4 camera and take a picture. Does any one know how to accomplish this?
or if there are an DLL you can use for the camera.

To use the native Windows camera "app" to capture an image you can make use of Windows.Media.Capture.CameraCaptureUI :

CameraCaptureUI captureUI = new CameraCaptureUI();
captureUI.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Jpeg;
captureUI.PhotoSettings.CroppedSizeInPixels = new Size(200, 200); 

StorageFile photo = await captureUI.CaptureFileAsync(CameraCaptureUIMode.Photo);

This will save the image to a location within your app's local storage where can you process as required.

See the following Microsoft article for more details: Capture photos and video with Windows built-in camera UI

我通过使用 Emgu CV 和 WPF 解决了这个问题: http ://www.emgu.com/wiki/index.php/Main_Page

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM