-
Notifications
You must be signed in to change notification settings - Fork 5k
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
The input packet MPImage returned by onResult
after detectAsync
call is corrupted
#5017
Labels
platform:android
Issues with Android as Platform
stat:awaiting googler
Waiting for Google Engineer's Response
task:hand landmarker
Issues related to hand landmarker: Identify and track hands and fingers
type:bug
Bug in the Source Code of MediaPipe Solution
Comments
definability
added a commit
to definability/mediapipe
that referenced
this issue
Dec 10, 2023
Issue google-ai-edge#5017 points to the issue of incorrect bitmap conversion in Android when RGBA or Grayscale images are used. As far as the library allows the creation of ALPHA8 bitmaps, it is not enough to use only `getBitmapFromRgb` and `getBitmapFromRgba`, so the new `getBitmapFromAlpha` method is needed. Otherwise, existing users relying on the 8-bit input but not using the input packet would catch errors despite their code operating as intended. Add correct processing of images with 1, 3, and 4 channels to `FaceDetector`, `FaceLandmarker`, `FaceStylizer`, `GestureRecognizer`, `HandLandmarker`, `HolisticLandmarker`, `ImageClassifier`, `ImageEmbedder`, `ImageSegmenter`, `InteractiveSegmenter`, `ObjectDetector`, and `PoseLandmarker`. If the number of channels is not 1, 3, or 4, throw MediaPipeException with `INVALID_ARGUMENT` status code. Implement methods and functions needed to convert single-channel images to RGBA bitmaps. The native function uses `memset` to set all bytes of the resulting buffer to zeros and then copies the alpha values of the input image to the alpha values of the corresponding output pixels. Perform a slight refactoring: use `operator[i]` instead of `*(array + i)` for clarity.
definability
added a commit
to definability/mediapipe
that referenced
this issue
Dec 10, 2023
Issue google-ai-edge#5017 points to the issue of incorrect bitmap conversion in Android when RGBA or Grayscale images are used. As far as the library allows the creation of ALPHA8 bitmaps, it is not enough to use only `getBitmapFromRgb` and `getBitmapFromRgba`, so the new `getBitmapFromAlpha` method is needed. Otherwise, existing users relying on the 8-bit input but not using the input packet would catch errors despite their code operating as intended. Add correct processing of images with 1, 3, and 4 channels to `FaceDetector`, `FaceLandmarker`, `FaceStylizer`, `GestureRecognizer`, `HandLandmarker`, `HolisticLandmarker`, `ImageClassifier`, `ImageEmbedder`, `ImageSegmenter`, `InteractiveSegmenter`, `ObjectDetector`, and `PoseLandmarker`. If the number of channels is not 1, 3, or 4, throw MediaPipeException with `INVALID_ARGUMENT` status code. Implement methods and functions needed to convert single-channel images to RGBA bitmaps. The native function uses `memset` to set all bytes of the resulting buffer to zeros and then copies the alpha values of the input image to the alpha values of the corresponding output pixels. Perform a slight refactoring: use `operator[i]` instead of `*(array + i)` for clarity.
definability
added a commit
to definability/mediapipe
that referenced
this issue
Dec 10, 2023
Issue google-ai-edge#5017 points to the issue of incorrect bitmap conversion in Android when RGBA or Grayscale images are used. As far as the library allows the creation of ALPHA8 bitmaps, it is not enough to use only `getBitmapFromRgb` and `getBitmapFromRgba`, so the new `getBitmapFromAlpha` method is needed. Otherwise, existing users relying on the 8-bit input but not using the input packet would catch errors despite their code operating as intended. Add correct processing of images with 1, 3, and 4 channels to `FaceDetector`, `FaceLandmarker`, `FaceStylizer`, `GestureRecognizer`, `HandLandmarker`, `HolisticLandmarker`, `ImageClassifier`, `ImageEmbedder`, `ImageSegmenter`, `InteractiveSegmenter`, `ObjectDetector`, and `PoseLandmarker`. If the number of channels is not 1, 3, or 4, throw MediaPipeException with `INVALID_ARGUMENT` status code. Implement methods and functions needed to convert single-channel images to RGBA bitmaps. The native function `AlphaToRGBA` uses `memset` to set all bytes of the resulting buffer to zeros and then copies the alpha values of the input image to the alpha values of the corresponding output pixels. Perform a slight refactoring: use `operator[i]` instead of `*(array + i)` for clarity.
Proposed fix: #5018. P.S. Does anybody know how to build a |
kuaashish
added
platform:android
Issues with Android as Platform
task:hand landmarker
Issues related to hand landmarker: Identify and track hands and fingers
labels
Dec 11, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
platform:android
Issues with Android as Platform
stat:awaiting googler
Waiting for Google Engineer's Response
task:hand landmarker
Issues related to hand landmarker: Identify and track hands and fingers
type:bug
Bug in the Source Code of MediaPipe Solution
Have I written custom code (as opposed to using a stock example script provided in MediaPipe)
No
OS Platform and Distribution
Android 11
Mobile device if the issue happens on mobile device
Redmi Note 8T
Browser and version if the issue happens on browser
No response
Programming Language and version
Kotlin
MediaPipe version
0.10.8
Bazel version
6.1.1
Solution
hand_landmarker
Android Studio, NDK, SDK versions (if issue is related to building in Android environment)
Android Studio 2023.1.1, Android SDK 30, Android NDK 21
Xcode & Tulsi version (if issue is related to building for iOS)
No response
Describe the actual behavior
The resulting input packet contains a horizontally stretched RGBA image with vertical stripes
Describe the expected behaviour
The resulting input packet must contain an identical image to the input one if it was RGBA/RGB
Standalone code/steps you may have used to try to get what you need
input
of typeMPImage
. Android Studio allows viewing the contents of bitmaps. Go toinput->containerMap->[AUtoValueMPImageProperties]->value->bitmap
and clickView Bitmap
.Other info / Complete Logs
No response
The text was updated successfully, but these errors were encountered: