Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix jpegOrientation for camera sensors not at 90 degrees #5

Merged
merged 1 commit into from
Apr 26, 2016

Conversation

reisub
Copy link

@reisub reisub commented Apr 20, 2016

Verified with turning my phone in all directions and taking pictures!
Also works correctly for the front camera on my Nexus 5X.

Please test on your Nexus 6, it has a 90 degree mounted camera in the back and a 270 degree camera mounted in the front (for the 5X it's the other way around).

@reisub
Copy link
Author

reisub commented Apr 20, 2016

Fixes #3. :)

@jmarkovic
Copy link
Contributor

Code looks good, I'm glad it fixes your problem. I will have to test on usual suspects just to avoid any regressions. Turning your phone does not break the layout and camera preview?

Also, I'll probably add Exif information in save process to this PR, I believe Nexus 5X did not write anything when we tested.

@reisub
Copy link
Author

reisub commented Apr 20, 2016

Turning works great for me. Check the exif info first, this might even add it - I'm not sure.

deviceOrientation = (deviceOrientation + 45) / 90 * 90;

// Reverse device orientation for front-facing cameras
boolean facingFront = cameraCharacteristics.get(CameraCharacteristics.LENS_FACING) == CameraCharacteristics.LENS_FACING_FRONT;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome that you think ahead!

@jmarkovic jmarkovic merged commit 98dc0b5 into master Apr 26, 2016
@jmarkovic jmarkovic deleted the fix/nexus-5x-orientation branch April 26, 2016 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants