-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Is there a way to change color in real time on the hair segmentation android? #18
Comments
Hi, Currently, the Recolor Calculator reads in a Color from the options , and reads those values into To enable changing the color every frame, a couple things need to happen:
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, |
Hi, I intend to make a slider(seekbar) for each of the RGB channels in the app. Do I need another calculator for inputting values from the sliders and output an array to the Recolor Calculator? If so ,how do I send the slider values to the new calculator? |
Hi, What data type is the "RGB_ARRAY" ? Let's say it is std::vector, then you should be accessing the data of the Packet via For the sliders, you could have them all in one calculator, and output the std::vector in one packet stream... or you could have separate calculators with separate streams "RED_VALUE","BLUE_VALUE"...etc, and then modify the Recolor Calculator to accept each color value stream separately .... If you already have some sliders that output values, then I would suggest creating one ColorSliderCalculator that outputs the RGB_ARRAY stream as a vector , and have the color slider calculator accept an InputSidePacket to a pointer to the slider values, then output those values as a packet (rgb vector<>) from the calculator. |
Hi, |
Hi, your You will probably want to use the FrameProcessor to get the packet creator, instead of creating a new one. You can also get access to the graph via the processor, in which you would add your packets to the input stream. See what onNewFrame is doing at To keep things simple, i would recommend sending in your custom packets each frame, regardless if the values change, so that calculators don't wait on missing inputs (there is a way to change this behavior later if desired). |
Hi |
Hi,
I don't see any modification to the Recolor calculator to accept the new rgb array packet stream. you will need to add this in GetContract to that calculator
then, in GlRender(), right after the also, you are really close in the java side. but putting everything in you want something like this
to receive callbacks each new camera frame see HERE where i did this in your MainActivity.java with RGBHandler also, you need to use PacketClonerCalculator in your graph to dupe the slider values each frame, otherwise (like i said previously), the graph will hang waiting for all input streams in the recolor calculator. see HERE where i modified your graph with PacketCloner BTW ^note the above links expire after a month hope that helps |
Likely something is not correct when starting/running the graph. At a quick glance, I don't see anything too wrong, except the output of ColorSliderCalculator... Can you use a unique pointer for the output packet of the ColorSliderCalculator , What does logcat say? |
Logcat outputs: I also tried following the letterbox padding example. But the app crashed with those modifications. Here is the gist with code modification and log. |
I don't see any error in the logcat posted please try this logcat command instead:
that^ it what i use for debugging but, is this error still relevant? I can maybe have a more detailed look later today or tomorrow |
Logcat outputs with this commit
The last 2 lines ( |
to make the black screen away, you need to publish the packets of RGB at least once outside of the callback, for example at the end of onCreate().
this way, everything is fine, but the color is not changing.
in fact, it is this following line that leads to the error:
i've tried different types of packets but it is always the same error. this makes me think, that somehow the packets never arrive, right? |
i forgot to mention that you should use System.currentTimeMillis() instead of packet.getTimestamp() inside the RGBHandler, because packet.getTimestamp() will output some invalid negative number. |
@gitunit I am the getting the same error as you when I send the packets at the end of onCreate() |
@sandipan1 so the black screen is gone for you as well? |
finally! i figured it out. the timestamp of the rgb packets was way ahead of the image, thus there were never packets ready to be synced with the images. you can debug those timestamp inside of Graph.java in the addConsumablePacketToInputStream method. |
@gitunit In order to sync with the frame , I have added frame.getTimeStamp(). Logcat is this However the black screen returns.I am not sure how to debug inside Graph.java . Can you suggest how to solve? |
easy, instead of the TextureFrameConsumer, you need to set the interface for OnWillAddFrameListener. this is an interface where you can get the timestamp before the image frame is being send. |
Now the video frame is displaying. However, the segmented hair is inverted vertically and the hair color is only black. No color change occurs when I change the slider positions.I have tried changing setting |
you can try removing the if you are in sync with the v0.6 release, you shouldn't need it, and that may be why things are flipped ... can you control the color if you manually set the r/g/b packets to hardcode a single color when calling addConsumablePacketToInputStream() ? (instead of the slider values) |
@sandipan1 Any updates from your end? We will close this for now. Pls reopen if u have updates |
I was trying to do this, as suggested in your latest comment, by setting Also about the Color Slider, It does not work but when I set the r/g/b packets to hardcode a single color when calling addConsumablePacketToInputStream(). How to fix this ? |
Hello What I do?
On the logcat I have this
And when scroll the color slide have this on the logcat The custom mediapipe git is here How can I resolve this ? thanks a lot! |
Hi i have the same black screen problem. How did you solve this problem? |
anyone with working solution with the new version of mediapipe? |
…ment_mp_hand_landmarks Feature - implement mp hand landmarks
I was wondering if there is a way to input RGB values dynamically in the RecolotCalculatorOptions in the graph
The text was updated successfully, but these errors were encountered: