×

CameraPreviewImageSource Class

An image source taking the preview buffer from an ICameraCaptureDevice. Implementations of ICameraCaptureDevice include PhotoCaptureDevice and AudioVideoCaptureDevice.

Inheritance Hierarchy

System..::..Object  Nokia.Graphics.Imaging..::..CameraPreviewImageSource

Namespace: Nokia.Graphics.ImagingAssembly: Nokia.Graphics.Imaging (in Nokia.Graphics.Imaging.dll) Version: 255.255.255.255

Syntax

C#
public sealed class CameraPreviewImageSource : IClosable, 
	IImageProvider, IImageSize, __ICameraPreviewImageSourcePublicNonVirtuals
Visual Basic
Public NotInheritable Class CameraPreviewImageSource 
	Implements IClosable, IImageProvider, IImageSize, __ICameraPreviewImageSourcePublicNonVirtuals
Visual C++
public ref class CameraPreviewImageSource sealed : IClosable, 
	IImageProvider, IImageSize, __ICameraPreviewImageSourcePublicNonVirtuals

Examples

C#

This sample takes snapshot image from back camera and renders it to screen.

private async Task ShowCameraSourceTask()
{
    var resolution = new Windows.Foundation.Size(640, 480);
    var task = PhotoCaptureDevice.OpenAsync(CameraSensorLocation.Back, resolution).AsTask();

    task.Wait();

    PhotoCaptureDevice camera = task.Result;
    camera.SetPreviewResolutionAsync(resolution).AsTask().Wait();

    using (var source = new CameraPreviewImageSource(camera))
    {
        // Create a target where the image will be rendered to
        var target = new WriteableBitmap((int)ImageControl.ActualWidth, (int)ImageControl.ActualHeight);

        // Create a new renderer which outputs WriteableBitmaps
        using (var renderer = new WriteableBitmapRenderer(source, target))
        {
            // Render the image
            await renderer.RenderAsync();

            // Set the output image to Image control as a source
            ImageControl.Source = target;
        }
    }
}
Visual Basic


Visual C++



Last updated 19 June 2014

Back to top

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×