KennardWang / VTuber-MomoseHiyori

😀 Live2D VTuber, made by Unity and Cubism. This project is based on TCP socket, OpenCV and deep learning
https://www.bilibili.com/video/BV1LM411X78G/
MIT License
167 stars 21 forks source link

Compatibility with Virtual Webcams on Windows #1

Open Edszx opened 3 years ago

Edszx commented 3 years ago

Hi, thank you very much for the program!, would it be possible to add compatibility for virtual webcam sources (not real USB webcams) like IP Webcam (Android), Droidcam, or Webcamoid? (I think they all use DirectShow filters)

KennardWang commented 3 years ago

Thank you for your sincere feedback! I think it may be an interesting question because I never meet a problem like this while debugging( I only test on computer's webcam ), I will do some researches on it and try to find a solution. By the way, if you could tackle with this problem, please tell me how to work out it, thanks!

954-Ivory commented 1 year ago

I ran it on GPU(GTX 1060) by DroidCamApp(windows, connect by USB).

This block will raise the IndexError: https://github.com/KennardWang/VTuber-MomoseHiyori/blob/fdb82ef8f4b1e11dd26e3d32401294c8dfa55a4a/Recognition/main.py#L159-L161

I changed it like this:

if steady_pose:
    roll = np.clip(-(180 + np.degrees(steady_pose[2])), -50, 50)
    pitch = np.clip(-(np.degrees(steady_pose[1])) - 15, -40, 40)  # the 15 here is my camera angle.
    yaw = np.clip(-(np.degrees(steady_pose[0])), -50, 50)

But it still just render 6 FPS.

Need I commit a PR for this?

我英语比较差,如果看不懂的话,我们就用中文聊吧。 😄

KennardWang commented 1 year ago

@954-Ivory Thank you very much for pointing out this bug, I guess the reason might be: Mobile USB camera does not initialize the value of roll, yaw, pitch etc. before position calibration. I modify the code and could you plz do me a favor to test again by your DroidCamApp? Btw, there are several possible reasons for low FPS (in my case, the GPU FPS is around 28):

非常感谢你指出这个bug,我想原因可能是,如果使用移动USB摄像头,源代码没有在位置校准前初始化roll, yaw, pitch等变量的值,所以我修改了源代码,能否请你使用DroidCamApp再帮我测试一下?顺带一提,个人认为FPS低的原因可能有以下几个(我自己测试的GPU版本的FPS在28左右):