从前置摄像头拍摄的图像被旋转 - Windows Phone 8

时间:2014-03-28 02:48:12

标签: c# xaml windows-phone-8

我做基本的Windows Phone应用程序。我需要通过前置摄像头拍摄照片。 预览没问题,但拍摄的光照旋转了(90°)。

CS:

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
    {
        if (PhotoCamera.IsCameraTypeSupported(CameraType.FrontFacing) == true)
        {            
            cam = new PhotoCamera(CameraType.FrontFacing);
            cam.CaptureImageAvailable += new EventHandler<Microsoft.Devices.ContentReadyEventArgs>(cam_CaptureImageAvailable);
            viewfinderBrush.SetSource(cam);               
        }
        else
        {
            txtMessage.Text = "No front camera";
        }
    }

XAML:

<Canvas x:Name="viewfinderCanvas" Height="640" Width="480" Tap="viewfinder_Tapped" Margin="0,138,0,46" Grid.RowSpan="2">
        <Canvas.Background>
            <VideoBrush x:Name="viewfinderBrush">
                <VideoBrush.RelativeTransform>
                    <CompositeTransform
                        x:Name="viewfinderTransform"
                        CenterX="0.5"
                        CenterY="0.5"
                        Rotation="-90"/>
                </VideoBrush.RelativeTransform>
            </VideoBrush>
        </Canvas.Background>
    </Canvas>

抱歉我的英文......

1 个答案:

答案 0 :(得分:0)

尝试从页面中删除SupportedOrientations和Orientation并检查。然后将旋转更改为90