Skip to content

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

Open
Almie wants to merge 6 commits intoApparence-io:masterfrom
Almie:preview-resolution-fix
Open

Fixes to Preview and AnalysisImage resolution selection, aspect ratio and convertFromImage#497
Almie wants to merge 6 commits intoApparence-io:masterfrom
Almie:preview-resolution-fix

Conversation

@Almie
Copy link
Copy Markdown

@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

Comment thread android/src/main/kotlin/com/apparence/camerawesome/cameraX/CameraAwesomeX.kt Outdated
hemantbeast added a commit to hemantbeast/CamerAwesome that referenced this pull request Sep 12, 2024
…olution selection, aspect ratio and convertFromImage
@lilran14
Copy link
Copy Markdown

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

@cuonghoang96
Copy link
Copy Markdown

When this can be merged?

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.

example/lib/ai_analysis_faces.dart landmarks are not drawn correctly over face example/lib/ai_analysis_faces.dart Does not work on samsung device

4 participants