Giter Club home page Giter Club logo

mediapipe_multi_hands_tracking_aar_example's Introduction

This fork serves as a sample on how to receive Bitmap image from graph for additional postprocessing (google/mediapipe#831).

It works with aar build with https://github.com/Cubbee/mediapipe, you can find instructions on how to build aar there.

Here is the outline on how to receive the bitmap from mediapipe graph:

  1. From the mediapipe side, you need to add GpuBufferToImageFrameCalculator to the graph somewhere, for example mediapipe/graphs/hand_tracking/hand_tracking_mobile.pbtxt
node {
   calculator: "GpuBufferToImageFrameCalculator"
   input_stream: "throttled_input_video"
   output_stream: "throttled_input_video_cpu"
 }
  1. Add this calculator to needed graph BUILD file mediapipe/graphs/hand_tracking/BUILD
cc_library(
    name = "mobile_calculators",
    deps = [
        "//mediapipe/calculators/core:constant_side_packet_calculator",
        "//mediapipe/calculators/core:flow_limiter_calculator",
        "//mediapipe/graphs/hand_tracking/subgraphs:hand_renderer_gpu",
        "//mediapipe/modules/hand_landmark:hand_landmark_tracking_gpu",
        "//mediapipe/gpu:gpu_buffer_to_image_frame_calculator",
    ],
)
  1. Listen to the packet and decode it to bitmap
processor.addPacketCallback(
    "transformed_image_cpu"
) { packet ->
    println("Received image with ts: ${packet.timestamp}")
    val image = AndroidPacketGetter.getBitmapFromRgba(packet)
}

Image is received from the graph and saved to external storage folder mediapipe as an example.

You need to give the app the external storage permission manually through the phone settings.

Don't forget to run adb shell setprop log.tag.MainActivity VERBOSE to enable logging

mediapipe_multi_hands_tracking_aar_example's People

Contributors

cubbee avatar

Stargazers

 avatar  avatar  avatar

Forkers

dangerous1990

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.