从前置摄像头捕获的图像是旋转的- Windows Phone 8
本文关键字:旋转 Windows Phone 图像 摄像头 | 更新日期: 2023-09-27 17:54:30
我做基本的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>
尝试从页面中删除SupportedOrientations和Orientation并检查。然后将旋转方向改为90