Win10 Sample: CameraGetPreviewFrame
Kamera Vorschaurahmen Probe
Dieses Beispiel gilt eine End-to-End-Ansatz zu zeigen, wie eine Kamera-Anwendung mit der Windows.Media.Capture API in Verbindung mit dem Display Information-API zu schreiben, um Bilder in der Vorschau von der Kamera Strom für die weitere Verarbeitung.
Camera preview frame sample
This sample applies an end-to-end approach to demonstrate how to write a camera application using the Windows.Media.Capture API in conjunction with the DisplayInformation API to acquire preview frames from the camera stream for further processing.
- Manage the MediaCapture object throughout the lifecycle of the app and through navigation events.
- Acquire a camera located on a specific side of the device. In this case, the sample attempts to get the rear camera.
- Start and stop the preview to a UI element, including mirroring for front-facing cameras.
- Get a preview frame using both overloads for the method.
- Get it as a Direct3DSurface and display information about the frame: Width, Height, Format.
- Get it as a SoftwareBitmap, display information about the frame: Width, Height, Format, and optionally display it on the screen and/or save it to disk.
Handle page rotation events to apply any necessary corrections to the preview stream rotation, ensuring acquired preview frames have the correct orientation and aspect ratio.
- Handle MediaCapture Failed event to clean up the MediaCapture instance when an error occurs.
Files im Sample:
Hauptsächlich die MainPage.xaml
Quelle:
https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/CameraGetPreviewFrame