Skip to content

Commit c467c33

Browse files
vermavinay982lzane
authored andcommitted
Fixed the closing of windows and releasing of camera.
after the execution of program the camera is struck and cant be used again. python goes into error and stops responding and the windows remain struck there as they were. this error is repaired now
1 parent 991a551 commit c467c33

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

new.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ def calculateFingers(res,drawing): # -> finished bool, cnt: finger count
122122
# Keyboard OP
123123
k = cv2.waitKey(10)
124124
if k == 27: # press ESC to exit
125+
camera.release()
126+
cv2.destroyAllWindows()
125127
break
126128
elif k == ord('b'): # press 'b' to capture the background
127129
bgModel = cv2.createBackgroundSubtractorMOG2(0, bgSubThreshold)
@@ -134,4 +136,4 @@ def calculateFingers(res,drawing): # -> finished bool, cnt: finger count
134136
print ('!!!Reset BackGround!!!')
135137
elif k == ord('n'):
136138
triggerSwitch = True
137-
print ('!!!Trigger On!!!')
139+
print ('!!!Trigger On!!!')

0 commit comments

Comments
 (0)