2016-05-15 2 views
0

xamlのキャプチャ要素には次のコードがあります。キャプチャ要素は、Windows Phoneで90度のプレビューを表示します。8.1

<CaptureElement Width="400" Height="400" x:Name="cameraCapture" Stretch="UniformToFill" Margin="0,0,0,40"> 
    </CaptureElement> 

マイページがプレビューで

private async void MainPage_Loaded(object sender, RoutedEventArgs e) 
    { 

     await captureManager.InitializeAsync(); 
     cameraCapture.Source = captureManager; 
     await captureManager.StartPreviewAsync(); 
    } 

をロードし、それは私がビューで、それは罰金が、保存した画像を働くよりも、プレビューする回転を設定した場合、まだ90度に回転させて回転した画像 enter image description here

を示し。これをどうすれば解決できますか?

captureManager.SetPreviewRotation(VideoRotation.Clockwise90Degrees); 

答えて

1

あなたが呼び出した後CapturePhotoToStreamAsyncあなたは、ストリームにこれらのものを適用する必要があります:

//create decoder and encoder 
BitmapDecoder dec = await BitmapDecoder.CreateAsync(imageStream); 
BitmapEncoder enc = await BitmapEncoder.CreateForTranscodingAsync(imageStream, dec); 

//roate the image 
enc.BitmapTransform.Rotation = BitmapRotation.Clockwise90Degrees; 

//write changes to the image stream 
await enc.FlushAsync(); 

それはちょうどスニペットですが、私はあなたのアイデアを得ると思います。 フルコードサンプルについては、こちらをご覧ください:https://dzone.com/articles/how-capture-photo-your-windows-0

関連する問題