Upside down camera preview byte array

2.5k views Asked by At

I have a camera application which is locked to landscape. When needed I rotate the raw bytes gotten from on onPreviewFrame() and use them to encode a video.

This approach however fails in the Nexus 5X and 6 devices, because their reversed sensor gives me upside-down frames.

As rotating the preview won't help me in this case, as described here:

This does not affect the order of byte array passed in onPreviewFrame(byte[], Camera)

I'd like to know if there's any way to detect that the camera sensor is reversed and/or the raw frame is upside down, so an extra correction is added when rotating them.

1

There are 1 answers

0
LordSidious On

the camera sensor of the Nexus 5x and 6 are rotated 180 degrees. A lot of apps had this problem when the device was released. You should take this into account while creating a camera app and set your surface rotation accordingly.

For more information go to https://stackoverflow.com/a/35431231/1492034