Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upside down camera preview byte array [duplicate]

Tags:

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.

like image 363
Edson Menegatti Avatar asked Nov 24 '15 20:11

Edson Menegatti


1 Answers

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

like image 148
LordSidious Avatar answered Nov 14 '22 01:11

LordSidious