Cinder
Cinder copied to clipboard
Camera capture orientation varies across devices
From @sansumbrella on June 18, 2015 15:0
From the testing folks, we found out that camera textures on the N6 are flipped vertically relative to other devices. Is there a way to find the camera's orientation from Android?
I looked at the android::hardware::Camera
interface but don't see any methods that currently expose the device's camera orientation.
Copied from original issue: chaoticbob/Cinder#22
From @sansumbrella on June 18, 2015 15:12
Also, I just noticed that the getNative()
function of Capture::Device is not declared on Android due to an #ifdef
. So the native information isn't available to users yet.
From @sansumbrella on June 18, 2015 20:11
Looks like this is a broader Nexus 6 issue.
http://forum.xda-developers.com/nexus-6/help/facing-camera-upside-inverted-t2953530
To give my two cents, I think it would be ideal if the android camera impl detected the capture orientation and provided a consistent output orientation to users. I guess that is if it's detectable, otherwise I suppose checking for know devices with problems isn't the end of the world, although hefty on the maintenance side.
And I found this on the forum @sansumbrella linked to: http://developer.android.com/reference/android/hardware/Camera.html#setDisplayOrientation%28int%29
From @sansumbrella on July 23, 2015 14:50
Yes, I definitely expected Cinder to give a consistently oriented output image. And I was surprised that Android has different orientations for different devices (in the same series).
@richardeakin That link looks promising. Thanks for uncovering it.
From @sansumbrella on July 23, 2015 14:58
It looks like that linked code is used in CameraV1.java. But it has a different method name.
Maybe it needs to be renamed setCameraDisplayOrientation
? Or maybe we're using CameraV2.java and it needs to have that code added?
I can't effectively test this since I only have an N5 that doesn't display the upside-down image issue.
From @sansumbrella on August 4, 2015 20:27
Judging from the logs, it looks like setDisplayOrientation
is called.
There must be something deeper happening on N6. Perhaps it's a timing issue with when the function is called.
From @sansumbrella on August 6, 2015 13:51
We are currently handling this by building multiple APKs and distributing a flipped image version for the Nexus 6.
This issue is a massive pain, even for native Android development. There are a few things that can be done to migigate it.
Specific devices can be excluded or compensated for, but this isn't an ideal solution. In addition, the EXIF data is sometimes inconsistent as well, so for example some images will be rotated 90 degrees or even flipped. It should be possible to create a library or utility to fix the majority of cases though, or at least raise a warning that the image has been flipped.