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

cmap-bg is iterated with each frame #209

Closed codecivil closed 3 weeks ago

codecivil commented 3 weeks ago

When I run lfbw with --cmap-bg, with each new frame the color map is applied recursively on the background image. For most color maps (for all except grey, I believe) this results in a single color background after less than 10 frames. The problem is solved by changing line 256

@@ -256,8 +256,7 @@

         # Apply colour map to the background
         if self.cmap_bg:
-            cv2.applyColorMap(background_frame, cmap(self.cmap_bg),
-                    dst=background_frame)
+            background_frame = cv2.applyColorMap(background_frame, cmap(self.cmap_bg))

         # Selfie processing
         for [k, *v] in self.selfie_effects:

The difference seems to be something like assignation by reference vs value, but I do not really know how dst works.

This is with opencv-python in version 4.10.0.84.

fangfufu commented 3 weeks ago

I have applied your suggestion.