Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0b57a6d

Browse files

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

‎new.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
threshold = 60 # BINARY threshold
1616
blurValue = 41 # GaussianBlur parameter
1717
bgSubThreshold = 50
18+
learningRate = 0
1819

1920
# variables
2021
isBgCaptured = 0 # bool, whether the background captured
@@ -25,7 +26,7 @@ def printThreshold(thr):
2526

2627

2728
def removeBG(frame):
28-
fgmask = bgModel.apply(frame)
29+
fgmask = bgModel.apply(frame,learningRate=learningRate)
2930
# kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (3, 3))
3031
# res = cv2.morphologyEx(fgmask, cv2.MORPH_OPEN, kernel)
3132

@@ -92,7 +93,7 @@ def calculateFingers(res,drawing): # -> finished bool, cnt: finger count
9293

9394
# get the coutours
9495
thresh1 = copy.deepcopy(thresh)
95-
im2,contours, hierarchy = cv2.findContours(thresh1, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
96+
_,contours, hierarchy = cv2.findContours(thresh1, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
9697
length = len(contours)
9798
maxArea = -1
9899
if length > 0:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /