Skip to content

Commit

Permalink
[!] add learningRate
Browse files Browse the repository at this point in the history
  • Loading branch information
lzane committed Jun 2, 2018
1 parent bc53c05 commit 0b57a6d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions new.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
threshold = 60 # BINARY threshold
blurValue = 41 # GaussianBlur parameter
bgSubThreshold = 50
learningRate = 0

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


def removeBG(frame):
fgmask = bgModel.apply(frame)
fgmask = bgModel.apply(frame,learningRate=learningRate)
# kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (3, 3))
# res = cv2.morphologyEx(fgmask, cv2.MORPH_OPEN, kernel)

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

# get the coutours
thresh1 = copy.deepcopy(thresh)
im2,contours, hierarchy = cv2.findContours(thresh1, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
_,contours, hierarchy = cv2.findContours(thresh1, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
length = len(contours)
maxArea = -1
if length > 0:
Expand Down

0 comments on commit 0b57a6d

Please sign in to comment.