Finding rotation angle of the image for camera in Android
<p>I am grabbing images from an Android camera using <code>onPreviewFrame.</code> The images do not always come out vertical. Looks like it is based on:</p>

<ol>
<li>The orientation of the camera with respect to the device as returned by <code>CameraInfo.orientation</code>. I guess this value is always fixed for a given device.</li>
<li>At what angle the user is holding the camera as returned by <code>Display.getRotation().</code></li>
<li>Whether the camera is front-facing or rear-facing.</li>
<li>Screen orientation as returned by <code>Configuration.orientation.</code></li>
</ol>

<p>I am wondering if anyone has a function that computes the angle one would need to rotate the obtained image. Regards.</p>