brianmtully / flutter_google_ml_vision

Flutter Plugin for Google ML Kit Vision
BSD 3-Clause "New" or "Revised" License
47 stars 46 forks source link

ALL_FACE contour positions wrong on iOS #14

Closed shliama closed 3 years ago

shliama commented 3 years ago

Same flutter code, using the same contour indexes (based on official doc) - iOS clearly has an issue. The code worked fine with the dead firebase_ml_vision plugin.

The code below looks okay to me, since it's pretty much the same as on Android. But I guess there is some issue with the contour parts 🤔 order.https://github.com/brianmtully/flutter_google_ml_vision/blob/e8dfedc8335fdd4bde861008cf290df6523f94e9/ios/Classes/FaceDetector.m#L123

Android iOS
android ios
brianmtully commented 3 years ago

Can you provide your drawing function for the contours that you are using?

shliama commented 3 years ago

Sure, here is a gist with the CustomPainter and snippet of its usage, should be easy to add into the plugin sample.

https://gist.github.com/shliama/f1ae6add1c879a0b0404e91fc1ae2f39

brianmtully commented 3 years ago

So after further inspection, the contours array returned on iOS are not in the order that you are expecting. The iOS MLKit doesn't seem to follow the order from the documentation when I grab all of the contours of a face. In order to get the result you expect I probably have to go one by one and input them into the resulting array.

allPoints isn't actually a contourType if you look through the documentation. I am just pulling all the points by looping through all the actual contours.

shliama commented 3 years ago

Changed the code based on your idea - https://github.com/brianmtully/flutter_google_ml_vision/pull/16 Tested with my mask and everything looks perfectly aligned now between iOS & Android.

brianmtully commented 3 years ago

thank you, I merged your pull request.