virtual-background-app icon indicating copy to clipboard operation
virtual-background-app copied to clipboard

Resolution is low

Open zzzzzzpc opened this issue 3 years ago • 7 comments

I build the application according to the guide, but the resolution is so low.

by the way, my phone is xiaomi10, and the resolution of my phone is 1920*1080p.

Any solution? pls!

zzzzzzpc avatar Dec 27 '20 06:12 zzzzzzpc

Hey, currently the resolution is 224x224 you can change it as follows

  1. resize the input image to 224x224(model's input-size), predict and get the 224x224 background mask
  2. resize both(input image and background mask) to original size(can be anything, say 1920*1080)
  3. background replacement can be done same as now

SwatiModi avatar Dec 27 '20 09:12 SwatiModi

Hey, currently the resolution is 224x224 you can change it as follows

  1. resize the input image to 224x224(model's input-size), predict and get the 224x224 background mask
  2. resize both(input image and background mask) to original size(can be anything, say 1920*1080)
  3. background replacement can be done same as now

zzzzzzpc avatar Mar 06 '21 02:03 zzzzzzpc

Hey, currently the resolution is 224x224 you can change it as follows

  1. resize the input image to 224x224(model's input-size), predict and get the 224x224 background mask
  2. resize both(input image and background mask) to original size(can be anything, say 1920*1080)
  3. background replacement can be done same as now

thankkkkk u! i have solved the problem! but now i meet a new trouble, i want change the background picture realtime without switching a new activity in android. could u give me some advice?

zzzzzzpc avatar Mar 06 '21 02:03 zzzzzzpc

Hey, currently the resolution is 224x224 you can change it as follows

  1. resize the input image to 224x224(model's input-size), predict and get the 224x224 background mask
  2. resize both(input image and background mask) to original size(can be anything, say 1920*1080)
  3. background replacement can be done same as now

thankkkkk u! i have solved the problem! but now i meet a new trouble, i want change the background picture realtime without switching a new activity in android. could u give me some advice?

its like i put a button and when i press it, a new background picture will show. it seems i have to add or modify the calculator.

zzzzzzpc avatar Mar 06 '21 02:03 zzzzzzpc

Yaa, you can actually do this by creating a new input stream which will decide the background image. Current I have hard-coded the background image here

Let's consider you have a int mapping of these names for now like 1:buildings.png, 2:cloulds.png etc ( alternatively you could also add a image input stream instead )

So you would have to

  1. write a small data handler class for this the main activity java file which will send a int input packet on every frame, the button listener logic you can write as you want,
  2. in the background_masking_calculator you would have to accept the input stream and decide the image name from the mapping you would maintain
  3. declare this input stream in the graph as well and pass it as input to the background masking node

Here's a example which would help you with this, here we wanted to send the R, G, B values dynamically from the app UI (similar to your use case), it has the streams declared and stream packets sent from java side to the graph and utilized by the calculator

SwatiModi avatar Mar 07 '21 17:03 SwatiModi

Hey, currently the resolution is 224x224 you can change it as follows

  1. resize the input image to 224x224(model's input-size), predict and get the 224x224 background mask
  2. resize both(input image and background mask) to original size(can be anything, say 1920*1080)
  3. background replacement can be done same as now

thankkkkk u! i have solved the problem! but now i meet a new trouble, i want change the background picture realtime without switching a new activity in android. could u give me some advice?

hi, how did y sovle the problem of low resolution ?

jls502 avatar Jul 15 '21 12:07 jls502

@SwatiModi, Can you share the full repo for the Hair Color Slider (https://github.com/google/mediapipe/issues/420) as I am having adding the ColorSliderCalculator.cc object. Thanks.

EPTION: ExternalTextureConverter
01-11 20:52:37.352  8544  9546 E AndroidRuntime: Process: com.google.mediapipe.apps.hairsegmentationgpu, PID: 8544
01-11 20:52:37.352  8544  9546 E AndroidRuntime: com.google.mediapipe.framework.MediaPipeException: unknown: ValidatedGraphConfig Initialization failed.
01-11 20:52:37.352  8544  9546 E AndroidRuntime: No registered object with name: ColorSliderCalculator; Unable to find Calculator "ColorSliderCalculator"
01-11 20:52:37.352  8544  9546 E AndroidRuntime: RecolorCalculator::GetContract failed to validate: 
01-11 20:52:37.352  8544  9546 E AndroidRuntime: For input streams ValidatePacketTypeSet failed:
01-11 20:52:37.352  8544  9546 E AndroidRuntime: Tag "RGB_OUT" index 0 was not expected.
01-11 20:52:37.352  8544  9546 E AndroidRuntime: 	at com.google.mediapipe.framework.Graph.nativeStartRunningGraph(Native Method)
01-11 20:52:37.352  8544  9546 E AndroidRuntime: 	at com.google.mediapipe.framework.Graph.startRunningGraph(Graph.java:324)
01-11 20:52:37.352  8544  9546 E AndroidRuntime: 	at com.google.mediapipe.components.FrameProcessor.startGraph(FrameProcessor.java:553)
01-11 20:52:37.352  8544  9546 E AndroidRuntime: 	at com.google.mediapipe.components.FrameProcessor.maybeAcceptNewFrame(FrameProcessor.java:421)
01-11 20:52:37.352  8544  9546 E AndroidRuntime: 	at com.google.mediapipe.components.FrameProcessor.onNewFrame(FrameProcessor.java:439)
01-11 20:52:37.352  8544  9546 E AndroidRuntime: 	at com.google.mediapipe.components.ExternalTextureConverter$RenderThread.renderNext(ExternalTextureConverter.java:403)
01-11 20:52:37.352  8544  9546 E AndroidRuntime: 	at com.google.mediapipe.components.ExternalTextureConverter$RenderThread.lambda$onFrameAvailable$0$ExternalTextureConverter$RenderThread(ExternalTextureConverter.java:338)
01-11 20:52:37.352  8544  9546 E AndroidRuntime: 	at com.google.mediapipe.components.ExternalTextureConverter$RenderThread$$Lambda$0.run(Unknown Source:4)
01-11 20:52:37.352  8544  9546 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:938)
01-11 20:52:37.352  8544  9546 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:99)
01-11 20:52:37.352  8544  9546 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:246)
01-11 20:52:37.352  8544  9546 E AndroidRuntime: 	at com.google.mediapipe.glutil.GlThread.run(GlThread.java:141)

ya332 avatar Jan 12 '22 08:01 ya332