C# 旋转前向摄像头拍摄的图像-Windows Phone 8
我做基本的Windows Phone应用程序。我需要用前置摄像头拍摄照片。 预览正常,但捕获的phoho旋转(90°) 政务司司长:C# 旋转前向摄像头拍摄的图像-Windows Phone 8,c#,xaml,windows-phone-8,C#,Xaml,Windows Phone 8,我做基本的Windows Phone应用程序。我需要用前置摄像头拍摄照片。 预览正常,但捕获的phoho旋转(90°) 政务司司长: 受保护的覆盖无效OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { if(PhotoCamera.IsCameraTypeSupported(CameraType.FrontFacing)=真) { cam=新的光电摄像机(摄像机类型:正面); cam.Captu
受保护的覆盖无效OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
if(PhotoCamera.IsCameraTypeSupported(CameraType.FrontFacing)=真)
{
cam=新的光电摄像机(摄像机类型:正面);
cam.CaptureImageAvailable+=新的事件处理程序(cam\u CaptureImageAvailable);
viewfinderBrush.SetSource(cam);
}
其他的
{
txtMessage.Text=“无前置摄像头”;
}
}
XAML:
对不起,我的英语…请尝试从页面中删除支持的方向和方向,然后进行检查。然后将旋转更改为90可以尝试旋转值中的90而不是-90,还可以在页面Xaml中的basepage标记中指定SupportedOrientations值和Orientation值当我将旋转设置为90=相机显示颠倒时。在SupportedOrientations中,我有一幅肖像……你能删除我在下面提到的SupportedOrientations吗?这就是我解决这个问题的方法。我尝试了一下,但没有成功。什么意思:支票。然后将旋转更改为90?
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";
}
}
<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>