Skip to content

Commit

Permalink
Use a shallow copy of segmentation_mask as it's readonly (#205)
Browse files Browse the repository at this point in the history
Fixes #201
  • Loading branch information
tbertels committed Mar 9, 2024
1 parent 12d04ee commit ffae907
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lfbw/lfbw.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import mediapipe as mp
from cmapy import cmap
from matplotlib import colormaps
import copy

class RealCam:
def __init__(self, src, frame_width, frame_height, frame_rate, codec):
Expand Down Expand Up @@ -229,7 +230,7 @@ def next_frame():
self.images["foreground_mask"]

def compose_frame(self, frame):
mask = self.classifier.process(frame).segmentation_mask
mask = copy.copy(self.classifier.process(frame).segmentation_mask)

if self.threshold < 1:
cv2.threshold(mask, self.threshold, 1, cv2.THRESH_BINARY, dst=mask)
Expand Down

0 comments on commit ffae907

Please sign in to comment.