Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Device Orientation in Windows Phone 8

I want to rotate the Image based on the device orientation in Windows Phone 8 while taking the snap using PhotoCaptureDevice option.

When the Device orientation is

LandscapeLeft  - Image to be rotated to -90
LandscapeRight - Image to be rotated to 90

But there is no option to find the device orientation in the Windows Phone 8 . Could you please anyone help me on this ?

like image 957
David Bekham Avatar asked Oct 05 '22 18:10

David Bekham


1 Answers

You can use the acceleration sensor readings and then take the atan2 as follows:

angle = Math.Atan2(-x,y) * 180.0 / Math.PI;

where "angle" is the device orientation relativ to the default portrait orientation.

like image 111
Hyndrix Avatar answered Oct 10 '22 01:10

Hyndrix