google-ai-edge / mediapipe

Cross-platform, customizable ML solutions for live and streaming media.
https://ai.google.dev/edge/mediapipe
Apache License 2.0
27.76k stars 5.18k forks source link

Saving output of MediaPipe graph as Bitmap/Image #2477

Closed arijith96 closed 3 years ago

arijith96 commented 3 years ago

System information (Please provide as much relevant information as possible)

Describe the expected behaviour: I wanted to know how I could go about saving the output of any of MediaPipe's graphs in the form of a Bitmap or just as an image file. We could just rewrite the same bitmap whenever the output frame is updated, but I am unclear how to go about this since the output of the graph is directly written onto the SurfaceView with the call processor.getVideoSurfaceOutput().setSurface(holder.getSurface())

Would I need another calculator like the GpuBufferToImageFrame before I send it to the output_stream?

Any help to guide me in the right direction would be highly appriciated! Amazing work with MediaPipe! :) Learning alot!

arijith96 commented 3 years ago

Hi @sgowroji Any update on this? I saw that you had changed the label to awaiting response

sgowroji commented 3 years ago

If you are looking for face mesh or hands refer those classes where we store the results of the image.

If you wanted for other solutions you can try this approach https://github.com/google/mediapipe/issues/2144 .

arijith96 commented 3 years ago

Hi @sgowroji

If I followed what was mentioned in #2144 correctly, the CameraX API would just provide us with the camera image. I was looking for something similar to the recently released Android Solutions, but not for face mesh and hands, rather for Object Detection, Box Tracking, KNIFT. Do correct me if I am wrong here. Quite new to Mediapipe and Android

sgowroji commented 3 years ago

You should wait for some days to get the other gradle android solutions . You can try the #2144 approach by building AAR specific to your solution, Here you need to implement the logic in JAVA.

arijith96 commented 3 years ago

Thank you for your reply! I will try to proceed as suggested.

In response to your comment, by when could we expect the other gradle android solutions to be released? Would all the android solutions be supported with gradle? Looking forward to trying them out! :D

sgowroji commented 3 years ago

@arijith96, We will let you know ETA soon. Thank you for the reply.

google-ml-butler[bot] commented 3 years ago

Are you satisfied with the resolution of your issue? Yes No

ibrandiay commented 3 years ago

@sgowroji Please, is there anything new about this?