SeedV/SeedAvatarStudio

Fix input_texture to keep original aspect ratio

Closed this issue · 7 comments

Fix input_texture to keep original aspect ratio

I think the reason is that the size of input_texture doesn't respect to the web camera aspect ratio, which has caused distortion to the source texture, and affected mediapipe model accuracy.

@superkudo can you see if the situation improved if changing it to your webcam resolution? I'm using 1920 x 1080 in my setup.

(PS, I have tried lower resolution, e.g. 800 x 600, 640 x 480, 320 x 240, they all seem work better than 200 x 200, but I can feel that the lower resolution is, the more staggering it feels)

For improvement, maybe when writing to the input texture, the size needs to be changed dynamically. I wonder if that's feasible.

Screen Shot 2022-05-27 at 1 09 14 AM

Get It,I will changing it recently

I try to use script change the created rendertexture , but failed, rendertexture width param is readonly; so I think set the rendertexture static size 1920x1080, computed the ratio before webcam frame put in with set the ratio in scale , this problem can be solved.

After the fix, the staggering has some improvement, and the mouth shape is able to be recognized, however this is still not at the same smoothness as my demo scene in SeedUnityVRKit.

@superkudo are you certain that the aspect ratio is fixed? Because it's still showing as 256 x 256 here:
https://github.com/SeedV/SeedAvatarStudio/blob/main/Assets/Materials/input_texture.renderTexture

  m_Width: 256
  m_Height: 256

Also, I can see the smaller window showing camera preview still has the wrong aspect ratio, not sure if this is just a display issue or not.

Plan to do more investigation.

Sorry, the inputtexture size not change because I plan commit inputtexture changed in scene change branch, I am wrong. I commit it in new normal branch

Change the viewport aspect ratio