Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Conversation

@idealopamp
Copy link
Contributor

…ases (#26786)

Uses accelerometer data to determine device orientation when the photo is taken. Fixes flutter/flutter#26786 .

…ases (#26786)

Uses accelerometer data to determine device orientation when the photo is taken.  Fixes flutter/flutter#26786 .

flutter/flutter#26786
@idealopamp
Copy link
Contributor Author

One known issue with the current solution: You may notice that if you shake the device up/down in portrait or left/right in landscape that the orientation sometimes comes out wrong. I think this approach might be more robust against unusual amounts of acceleration, e.g. the user is in a bumpy car ride, if one were to take an average/smoothing of the accelerometer metrics over the past few seconds, but that requires a bit more work to implement, so just starting with this to see what you think.

@idealopamp
Copy link
Contributor Author

One known issue with the current solution: You may notice that if you shake the device up/down in portrait or left/right in landscape that the orientation sometimes comes out wrong. I think this approach might be more robust against unusual amounts of acceleration, e.g. the user is in a bumpy car ride, if one were to take an average/smoothing of the accelerometer metrics over the past few seconds, but that requires a bit more work to implement, so just starting with this to see what you think.

@idealopamp idealopamp closed this Feb 1, 2019
@idealopamp idealopamp reopened this Feb 1, 2019
@idealopamp
Copy link
Contributor Author

One known issue with the current solution: You may notice that if you shake the device up/down in portrait or left/right in landscape that the orientation sometimes comes out wrong. I think this approach might be more robust against unusual amounts of acceleration, e.g. the user is in a bumpy car ride, if one were to take an average/smoothing of the accelerometer metrics over the past few seconds, but that requires a bit more work to implement, so just starting with this to see what you think.

Haven't written it in objective-c, but using the sensors library in dart, averaging over 200 milliseconds seemed to do pretty well at preventing jittery movements from affecting the outcome, although I did not test in an actual bumpy car.

Copy link
Contributor

@mklim mklim left a comment

Choose a reason for hiding this comment

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

lgtm

Thanks again for investigating this and submitting a PR! I tested it out with front and rear cameras. It doesn't have any regressions and fixes the edge case that's currently broken now. This code LGTM pending a review from @cyanglaz to verify the objective c style.

@mklim mklim requested review from cyanglaz and removed request for bparrishMines February 7, 2019 20:56
Copy link
Contributor

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

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

A tiny nit otherwise LGTM.

@mklim mklim merged commit 4b037c1 into flutter:master Feb 7, 2019
andreidiaconu pushed a commit to andreidiaconu/plugins that referenced this pull request Feb 17, 2019
flutter#1135)

Uses accelerometer data to determine device orientation when the photo is taken.  Fixes flutter/flutter#26786 .

flutter/flutter#26786
andreidiaconu added a commit to andreidiaconu/plugins that referenced this pull request Feb 17, 2019
karantanwar pushed a commit to karantanwar/plugins that referenced this pull request Feb 19, 2019
flutter#1135)

Uses accelerometer data to determine device orientation when the photo is taken.  Fixes flutter/flutter#26786 .

flutter/flutter#26786
karantanwar pushed a commit to karantanwar/plugins that referenced this pull request Feb 19, 2019
flutter#1135)

Uses accelerometer data to determine device orientation when the photo is taken.  Fixes flutter/flutter#26786 .

flutter/flutter#26786
Akachu pushed a commit to Akachu/flutter_camera that referenced this pull request Apr 27, 2020
flutter#1135)

Uses accelerometer data to determine device orientation when the photo is taken.  Fixes flutter/flutter#26786 .

flutter/flutter#26786
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants