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 0226539

Browse files
committed
Some statement changed
changes acc to version
1 parent 9babfc6 commit 0226539

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

‎new.py‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import numpy as np
33
import copy
44
import math
5-
from appscript import app
5+
#from appscript import app
66

77
# Environment:
88
# OS : Mac OS EL Capitan
@@ -92,7 +92,7 @@ def calculateFingers(res,drawing): # -> finished bool, cnt: finger count
9292

9393
# get the coutours
9494
thresh1 = copy.deepcopy(thresh)
95-
contours, hierarchy = cv2.findContours(thresh1, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
95+
im2,contours, hierarchy = cv2.findContours(thresh1, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
9696
length = len(contours)
9797
maxArea = -1
9898
if length > 0:
@@ -112,8 +112,9 @@ def calculateFingers(res,drawing): # -> finished bool, cnt: finger count
112112
isFinishCal,cnt = calculateFingers(res,drawing)
113113
if triggerSwitch is True:
114114
if isFinishCal is True and cnt <= 2:
115-
print cnt
116-
app('System Events').keystroke(' ') # simulate pressing blank space
115+
print (cnt)
116+
#app('System Events').keystroke(' ') # simulate pressing blank space
117+
117118

118119
cv2.imshow('output', drawing)
119120

@@ -122,14 +123,14 @@ def calculateFingers(res,drawing): # -> finished bool, cnt: finger count
122123
if k == 27: # press ESC to exit
123124
break
124125
elif k == ord('b'): # press 'b' to capture the background
125-
bgModel = cv2.BackgroundSubtractorMOG2(0, bgSubThreshold)
126+
bgModel = cv2.createBackgroundSubtractorMOG2(0, bgSubThreshold)
126127
isBgCaptured = 1
127-
print '!!!Background Captured!!!'
128+
print( '!!!Background Captured!!!')
128129
elif k == ord('r'): # press 'r' to reset the background
129130
bgModel = None
130131
triggerSwitch = False
131132
isBgCaptured = 0
132-
print '!!!Reset BackGround!!!'
133+
print ('!!!Reset BackGround!!!')
133134
elif k == ord('n'):
134135
triggerSwitch = True
135-
print '!!!Trigger On!!!'
136+
print ('!!!Trigger On!!!')

0 commit comments

Comments
(0)

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