Linux-Fake-Background-Webcam icon indicating copy to clipboard operation
Linux-Fake-Background-Webcam copied to clipboard

Overload resolution failed

Open rahra opened this issue 1 year ago • 3 comments

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'

rahra avatar Jan 24 '24 10:01 rahra

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

tinnuadan avatar Jan 31 '24 10:01 tinnuadan

@rahra , did downgrading fix this?

fangfufu avatar Feb 01 '24 03:02 fangfufu

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

rahra avatar Feb 01 '24 09:02 rahra