profile
viewpoint

Ask questionsIs there a way to change color in real time on the hair segmentation android?

I was wondering if there is a way to input RGB values dynamically in the RecolotCalculatorOptions in the graph

google/mediapipe

Answer questions mcclanahoochie

Hi,

Currently, the Recolor Calculator reads in a Color from the options , and reads those values into color_ during the calculator's Open() funtion, and sends the values to the GPU during InitGPU() .

To enable changing the color every frame, a couple things need to happen:

  1. Create an input_stream of Color values (or an array, or your own custom struct) . This would look similar to the "IMAGE_GPU" packet stream (except with a different datatype).
  2. Read those values into color_ during ProcessGPU (again similar to how it's done here and here )
  3. Send the values to the GPU, via adding glUniform3f(glGetUniformLocation(program_, "recolor"), color_[0], color_[1], color_[2]); right after the call to glUseProgram(program_); inside of GlRender() .
  4. Also don't forget to register the new stream in GetContract()

After all that is done, you would need another calculator to send in the new color values, and that would be up to you on the logic.

These changes to Recolor Calculator are something we can consider adding in the future, but right now there is no timeline for it.

Hopefully that provides some insight for you.

Cheers, ~Chris

useful!

Related questions

Get hand_tracking_cpu source code to extract detected hand metadata hot 2
stdout: stderr: xcodebuild: error: SDK "macosx10.10" cannot be located. - mediapipe hot 1
SSL certification error while downloading dependency libraries via Bazel hot 1
Build of Hello World Failed on Darwin (MacOS) hot 1
unable to run multi-hand tracking on video - mediapipe hot 1
Build of Hello World Failed on Darwin (MacOS) hot 1
Bazel build failed in Android Studio hot 1
Memory leak of facedetectioncpu example on Android (RK3399 specific) - mediapipe hot 1
Fail to pull in MediaPipe's external dependencies due to unstable internet connection hot 1
at com.google.mediapipe.apps.objectdetectioncpu.MainActivity.<clinit>(MainActivity.java:50) hot 1
Hand Tracking Desktop GPU Build Error hot 1
ERROR: An error occurred during the fetch of repository 'bazel_skylib' hot 1
Bazel build failed to fetch Maven dependency hot 1
Running error hot 1
Hello World failed build on Raspberry Pi - mediapipe hot 1
source:https://uonfu.com/
Github User Rank List