1

我想在 Windows phone8 中创建一个应用程序。在这个应用程序中,我想在 Windows phone 8 中使用 C# 在多帧中显示具有不同效果的实时相机预览。请给我一个解决方案

4

1 回答 1

1

要在 Windows phone 8 中使用相机,您需要使用PhotoCamera对象。最好像这样创建这个对象OnNavigatedTo

protected override void OnNavigatedTo (System.Windows.Navigation.NavigationEventArgs e) 
{ 
    if (PhotoCamera.IsCameraTypeSupported(CameraType.Primary) == true) 
    { 
        cam = new PhotoCamera(CameraType.Primary); 
        cam.CaptureImageAvailable += new EventHandler<Microsoft.Devices.ContentReadyEventArgs>(cam_CaptureImageAvailable); 
        viewfinderBrush.SetSource(cam); 
    }
    else 
    {
        txtMessage.Text = "A Camera is not available on this device."; }
    }   
}
// dispose when we leave
protected override void OnNavigatingFrom (System.Windows.Navigation.NavigatingCancelEventArgs e) 
{ 
    if (cam != null) 
    { 
        cam.Dispose(); 
    } 
}

要实际从相机捕获图像,您可以调用cam 对象上的CaptureImage方法。

于 2013-03-18T16:09:24.637 回答