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

Face detection mobile output bitmap null #2218

Closed Monibsediqi closed 3 years ago

Monibsediqi commented 3 years ago

Please make sure that this is a bug and also refer to the troubleshooting, FAQ documentation before raising any issues.

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

Describe the current behavior: I slightly modified the out_stream in the graph. In order to get the output bitmap image I added: out_stream:input_video_cpu This input_video_cpu is received from the following calculator: node: { calculator: "GpuBufferToImageFrameCalculator" input_stream: "throttled_input_video" output_stream: "input_video_cpu" } This is how I get the bitmap image from the graph:

processor!!.graph.addPacketCallback("input_video_cpu") { packet -> val frame = AndroidPacketGetter.getBitmapFromRgba(packet) // val rgbMapPut = Bitmap.createScaledBitmap(frame, 1920, 1080, false)

        rgbMap[packet.timestamp.toString()] = frame

} Please note that If I try to createScaledBitmap as specified in the above commented out statement of the code, I get all null output. Right now I get the following output: current Bitmap Width: 2069, Height: 1164 current Bitmap Width: null, Height: null current Bitmap Width: null, Height: null current Bitmap Width: null, Height: null current Bitmap Width: null, Height: null current Bitmap Width: null, Height: null current Bitmap Width: null, Height: null current Bitmap Width: 2069, Height: 1164 current Bitmap Width: 2069, Height: 1164 current Bitmap Width: 2069, Height: 1164 current Bitmap Width: null, Height: null current Bitmap Width: null, Height: null current Bitmap Width: null, Height: null

Describe the expected behavior: The expected output behavior is a non-null (image).

Please let me know if you needed more details to better understand the problem Anyone, please reply if you have faced a similar problem and solved it.

sgowroji commented 3 years ago

Hi @Monibsediqi, Could you please provide the below details to investigate it further.

  1. Complete Code changes of graph and MainActivity.java
  2. Image tried for testing, which resulted null for the bitmap.
  3. Tested on what version of Android studio?

Thanks!

Monibsediqi commented 3 years ago

I solved this issue. Thanks. The problem was with the timestamp of the image.

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

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

Moufdi96 commented 3 years ago

Hello @Monibsediqi, I tried you approach to retrieve input frames but it keeps crashing showing this log "A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 18307 (Thread-20), pid 18097 (m.example.testApp)" do you know the reason please ? if not do you by any chance know how can I modify the output stream so that I can add graphic overlays on top of it before being rendered to the FrameLayout, thanks in advance.