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

Android. Process ARGB and Grayscale input packets #5018

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Dec 10, 2023

  1. Android. Process ARGB and Grayscale input packets

    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.
    definability committed Dec 10, 2023
    Configuration menu
    Copy the full SHA
    4c21321 View commit details
    Browse the repository at this point in the history