windows runtime - Rotate a CamerePreviewImageSource -
I am trying to rotate a camera preview source to display it (only) in portrait mode:
Private async Task Initialisyes () {this.cameraPreviewImageSource = New CameraProjectSource (); Device Information Clearing Tool = Wait. Windows.Devices.Enumeration.DeviceInformation.FindAllAsync (Windows.Devices.Enumeration.DeviceClass.VideoCapture); String Backcamera ID = Devices Frstor default (X = & gt; X. Point Location! = Null & amp; x. Location. Panel == Vindojhkdiwais. Antrtenmentkpanl. Wait back. ID, camera Krenpriwuijhessors. Early Aesink (Bakkamraid); Video encoding properties properties = this hodge preview Image source. Startprwyuesaiansisi (); double width = 1280; double height = 720; This.writeableBitmap = new writable bitmap ((int) width (integer) height); Thiskc apturePreview.Source = this.writeable bitmap; This.writeableBitmapRenderer = new writable bitmap renderer (); This.jpegRenderer = new JPEGRenderer (); available This.cameraPreviewImageSource.previewFrameAvailable + = Purwpradrshnfrem;} < P> I also tried in the file, but most of the time is weird (as if 90% of the picture is hidden): x: name = "capture preview" grid. column = "0" grid. roll = "0" grid. Colmspan = "3" grid. rowspan = "3" width = "auto" height = "auto" canvas. Jedendeks = "0" & Gt; & lt; Image.RenderTransform & gt; & Lt; Composite Transformer Center X = "0.5" Center Y = "0.5" rotation = "90" /> & Lt; /Image.RenderTransform> & Lt; / Image & gt; Any ideas? Try this switch, width and height, and set rotation filter to 90 with rotation.
Also set device orientation to portrait . If you want help with other orientation in other apps, simply set the Orientation > OnNavigatedTo / OnNavigatedFrom or
private async Task Initialize () {this.cameraPreviewImageSource = new CameraPreviewImageSource (); Device Information Clearing Tool = Wait. Windows.Devices.Enumeration.DeviceInformation.FindAllAsync (Windows.Devices.Enumeration.DeviceClass.VideoCapture); String Backcamera ID = Devices Frstor default (X = & gt; X. Point Location! = Null & amp; x. Location. Panel == Vindojhkdiwais. Antrtenmentkpanl. Wait back. ID, camera Krenpriwuijhessors. Early Aesink (Bakkamraid); Video Encoding Properties Properties = This Camera Preview Image Source. StartupviewsINCC (); Double width = 1280; Double height = 720; This.writeableBitmap = New writable bitmap ((int) height, (integer) width); This.c ApturePreview.Source = this.writeable bitmap; Var effect = new filter effect (m_cameraPreviewImageSource); effect filter = new iFilter [] {new rotation filter (90)}; This.writeableBitmapRenderer = new writeable bitmap renderer (effect); JpegRenderer = new JPEGRenderer (); This.cameraPreviewImageSource.previewFrameAvailable + = PreflightFrequent Available;} To Rename Protected Override Zero (Navigation EventVers E) {m_displayOrientations = DisplayInformation.AutoRotationPreferences; DisplayInformation.AutoRotationPreferences = DisplayOrrentation.Portet; NavigationHelper.OnNavigatedTo (E); } Protected override minus renewedYou (NavigationEventErds e) {DisplayInformation.AutoRotationPreferences = m_displayOrientations; NavigationHelper.OnNavigatedFrom (E); }
Comments
Post a Comment