fangfufu / Linux-Fake-Background-Webcam

Faking your webcam background under GNU/Linux, now supports background blurring, animated background, colour map effect, hologram effect and on-demand processing.
GNU General Public License v3.0
1.61k stars 161 forks source link

Overload resolution failed #201

Closed rahra closed 8 months ago

rahra commented 10 months ago

It fails to work at a most recent Ubunut 23.10 as soon as a consumer connects. It is installed into a venv.

$ lfbw --no-foreground
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1706091842.742890    5257 gl_context_egl.cc:85] Successfully initialized EGL. Major : 1 Minor: 5
I0000 00:00:1706091842.744904    5292 gl_context.cc:344] GL version: 3.2 (OpenGL ES 3.2 Mesa 23.2.1-1ubuntu3.1), renderer: Mesa Intel(R) UHD Graphics 620 (WHL GT2)
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
Real camera original values are set as: 640x480 with 30 FPS and video codec 1448695129
Real camera new values are set as: 1280x720 with 30 FPS and video codec 1196444237
Running...
Please CTRL-C to pause and reload the background / foreground images
Please CTRL-\ to exit
No consumers remaining, paused
Consumers: 1
Real camera original values are set as: 640x480 with 30 FPS and video codec 1448695129
Real camera new values are set as: 1280x720 with 30 FPS and video codec 1196444237
Traceback (most recent call last):
  File "/home/bfischer/Development/Linux-Fake-Background-Webcam/bin/lfbw", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/bfischer/Development/Linux-Fake-Background-Webcam/lib/python3.11/site-packages/lfbw/lfbw.py", line 553, in main
    cam.run()
  File "/home/bfischer/Development/Linux-Fake-Background-Webcam/lib/python3.11/site-packages/lfbw/lfbw.py", line 326, in run
    frame = self.compose_frame(frame)
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bfischer/Development/Linux-Fake-Background-Webcam/lib/python3.11/site-packages/lfbw/lfbw.py", line 235, in compose_frame
    cv2.threshold(mask, self.threshold, 1, cv2.THRESH_BINARY, dst=mask)
cv2.error: OpenCV(4.9.0) :-1: error: (-5:Bad argument) in function 'threshold'
> Overload resolution failed:
>  - dst marked as output argument, but provided NumPy array marked as readonly
>  - Expected Ptr<cv::UMat> for argument 'dst'
tinnuadan commented 10 months ago

Seems to be related to https://github.com/opencv/opencv/issues/24522. I had the same error on Manjaro and could workaround it by downgrading to opencv 4.8: pip install opencv-contrib-python==4.8.1.78 opencv-python==4.8.1.78

fangfufu commented 10 months ago

@rahra , did downgrading fix this?

rahra commented 10 months ago

I just did the downgrade as suggested above and it works for me as well.