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

Fixes to Preview and AnalysisImage resolution selection, aspect ratio and convertFromImage #497

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Almie
Copy link

@Almie Almie commented Jul 20, 2024

Description

  • Updated resolution selection in CameraX from the deprecated setTargetAspectRatio/setTargetResolution to setResolutionSelector
    • This fixes a bug where the incorrect resolution for ImageAnalysis would be selected because setTargetResolution expected a flipped X/Y input.
    • ImageAnalysis now picks a resolution matching the aspect ratio of the preview if possible
    • TODO: Since 1:1 aspect ratio is not directly supported by CameraX, a ResolutionFilter is needed to force a 1:1 aspect ratio when selected.
  • Fixed previewAlignment not working correctly as well as AnimatedPreviewFit not animating correctly on aspect ratio changes
    • Preview.offset is now calculated as offset coordinates of the preview on screen, taking the alignment into account, which helps calculate Preview.convertToImage correctly
  • Fixed Preview.convertToImage function now correctly converts point coordinates from AnalysisImage to Preview
  • preview_overlay_example and ai_analysis_faces now work correctly on Android with the right positioning of the overlay elements

fixes #491
fixes #475

Checklist

Before creating any Pull Request, confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]).

  • 📕 I read the Contributing page.
  • 🤝 I match the actual coding style.
  • ✅ I ran flutter analyze without any issues.

Breaking Change

  • 🛠 My feature contain breaking change.

If your feature break something, please detail it

hemantbeast added a commit to hemantbeast/CamerAwesome that referenced this pull request Sep 12, 2024
…olution selection, aspect ratio and convertFromImage
@lilran14
Copy link

I am also experiencing this bug. Some devices are producing incorrect coordinates.
When can this be merged into the master? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants